3

There is wonderful tutorial how to use OAuth2 api to be authenticated by github. But if I want to use same api for facebook. I tried following and end up with error. So how can use OAuth2 api for facebook?

    fb.client.id=79756xxxxxxxx 

    fb.client.secret=205adxxxxx


    fb.redirect.url= "https://graph.facebook.com/oauth/access_token?client_id=%s&redirect_uri=%s&client_secret=%s&code=%s"

  // eventually url is filled as

  https://graph.facebook.com/oauth/access_token?toeken&client_id=797565xxxx&redirect_uri=http://localhost:9000/_oauth-callback&client_secret=email&code=e3887ea3-3319-4462-a3b1-xxxxx

 // get this error
  {
  "error": {
  "message": "Invalid verification code format.",
  "type": "OAuthException",
  "code": 100
   }
 }

Update after updating the request url as

 fb.redirect.url="https://graph.facebook.com/oauth/authorize?client_id=%s&redirect_uri=%s"

I managed to get facebook's login prompt. After submitting fb credential my redirect url is called as

      http://localhost:9000/_oauth-callback/?code=AQD72MtTesmEIoQty3c0ZTC3a211egWR0pvVcLGhb6lB2T6TslG7r99IouP6KbE4oDYCl7n0_imyI0zxe-8Nb2CUDsRN5pEyQ_Pk6JRwy0JRy3T27kbDJ9DRcr11NrDdlZtNK3tOe6kfTdVQm52YXMTF7L9Kq3N6z0ZIBbVxsizvWZ00kVUL2YkSdnh5mpx4ofKaTgd0pHNhE9X33mBdzS7Evu_R0yW8XqgZFfvEPFE3f1e9qdrbrhwHaj1kfZyk6NigDBpnyZ5CgtzFTDpLHZVKQXCWDNzfqMwlxYuV2amTJUEgq77_HzxnDD3njvU4dJK0lrpVrkimqMeldCFEHzbV#_=_

I don't know how to use this code = XXX. Don't even know what does this code mean? How can ask user public profile info after my redirect url is called? Please let me

masiboo
  • 4,537
  • 9
  • 75
  • 136
  • I written it in Java and Spring, might be helpful for you : http://aggarwalarpit.blogspot.in/2014/08/spring-social-integration-with-facebook.html – Arpit Aggarwal Mar 10 '15 at 08:33
  • Do these help? http://stackoverflow.com/questions/5001692/unable-to-get-access-token-from-facebook-got-an-oauthexception-says-error-vali – Barry Mar 10 '15 at 09:52

0 Answers0