Reputation: 4770
I've a simple HTML/Javascript page, served locally on localhost:5000. On Azure I've a App Service running a Aspnet core API.
I've set up CORS so I can access the API from my page. Now I try to enable Facebook authentication. From my page I use facebook SDK. I works fine and I can login to my facebook-application. I get back a access token.
My problem is how to authenticate in my Rest Api. On the Azure portal I've turned on "App Service Authentication" and "Log in with Facebook".
If I've understood the docs correctly I'm supposed to provide the access token from Facebook to my Azure RestApi. I use the following code to do that.
const resp = await fetch('https://<mysite>.azurewebsites.net/.auth/login/facebook',
{
method: 'POST',
body: {
"access_token": fbToken
}
});
Unfortunaletly I got a 400 response, saying "Invalid client credentials".
What's wrong? How can it be fixed?
Upvotes: 1
Views: 45
Reputation: 4770
It was a really silly mistake. I missed to serialize the body to JSON.
body: JSON.stringify({
"access_token": fbToken
})
Upvotes: 1