SammyK / LaravelFacebookSdk

Fully unit tested Facebook SDK v5 integration for Laravel & Lumen
MIT License
692 stars 200 forks source link

Redirect_uri is identical to the one you used in the OAuth dialog request #201

Closed JCarlosR closed 6 years ago

JCarlosR commented 6 years ago

Hi.

I am redirecting the users to the next login url: $loginUrl = $fb->getLoginUrl($permissions, url('/admin/posts/callback'));

If I print it, I get:

https://www.facebook.com/v2.8/dialog/oauth?client_id=553974898124336&state=22ff3266dddb10b2b68c205e5ee2cf16&response_type=code&sdk=php-sdk-5.4.2&redirect_uri=https%3A%2F%2Ftombofans.com%2Fadmin%2Fposts%2Fcallback&scope=publish_actions%2Cuser_managed_groups

And after grants the permissions, the next error message appears: image

The question is why? The redirect_uri is the same.

JCarlosR commented 6 years ago

I was using $token = $fb->getAccessTokenFromRedirect();. I have changed it to $token = $fb->getAccessTokenFromRedirect(url('/admin/posts/callback')); and it is working.