0
votes

I'm setting oauth2 login (facebook) in my web application referring to some document.


I wrote the complete code, but it did not work.
Below is my oauth client auth flow.
After step 4, I need to send a code and get an access token. But I can't find the code for this anywhere.

  1. connect - localhost:8080/login/facebook
  2. redirect - https://www.facebook.com/v3.0/dialog/oauth?redirect_uri=xxx&state=xxx&scope=public_profile+email+user_birthday&response_type=code&client_id=xxx&ret=login&logger_id=a10dd655-25bb-1234-baab-faeaae59d6e4&ext=1531667216&hash=Aeb1-TBSbxIpZa7c
  3. facebook login
  4. redirect - localhost:8008/login/facebook?code={some code}


I tried the following to get the access code using postman. But I received error messsage; Invalid verification code format (error_code 100)

GET - https://graph.facebook.com/oauth/access_token?code=##&redirect_uri=##&client_id=##&client_secret=##

How to get access code?..
Why can't I get the access_code?

1

1 Answers

0
votes

How to get access code?..

OK.. there is no straight way to get access_token from code which is a result of redirect - localhost:8008/login/facebook?code={some code}

Use below API to get access_token from code.

https://graph.facebook.com/v2.11/oauth/access_token?client_id={client_id}&redirect_uri={redirect_uri}&client_secret={client_secret}&code={code}

Result of above API would return you access_token.