C
C#3y ago
İrşat

I can't get fetch body as plain string [Answered]

public async Task<JsonResult> GoogleSignin([FromBody] string googleToken)
public async Task<JsonResult> GoogleSignin([FromBody] string googleToken)
await fetch("/Auth/GoogleSignin", {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: response.credential
})
await fetch("/Auth/GoogleSignin", {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: response.credential
})
Normal text instead of response.credential also doesn't work. I used json stringfy, object etc, didn't work
3 Replies
İrşat
İrşatOP3y ago
this was working with jquery ajax
mikernet
mikernet3y ago
You've set the content type as json Set it to text/plain
Accord
Accord3y ago
✅ This post has been marked as answered!
Want results from more Discord servers?
Add your server