C
C#2y 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şat2y ago
this was working with jquery ajax
mikernet
mikernet2y ago
You've set the content type as json Set it to text/plain
Accord
Accord2y ago
✅ This post has been marked as answered!