sahat / satellizer

Token-based AngularJS Authentication
https://satellizer-sahat.rhcloud.com
MIT License
7.85k stars 1.13k forks source link

facebook redirect uri error (reference #845) #846

Open harryy2510 opened 8 years ago

harryy2510 commented 8 years ago

This is what my code looks like

$authProvider.facebook({
    clientId: '........',
    redirectUri: window.location.origin + '/'
});

in my facebook account, site url is mentioned as http://officebus.com/

In my laravel services.php file redirectUri is mentioned as url('/')

My AuthController

public function socialLogin($provider=null, Request $request)
    {
        if ($request->has('redirectUri')) {
            config()->set("services.{$provider}.redirect", $request->get('redirectUri'));
        }
        $provider = Socialite::with($provider);
        $provider->stateless();

        try {
            $profile = $provider->user();
        } catch (ClientException $e) {
            return response()->json(['message' => (string) $e->getResponse()->getBody()], 500);
        }

        return response()->success(compact('profile'));

    }

It still gives the same error :(

zoomedout commented 8 years ago

@harryy2510 site url is not the redirect/callback url site url is you website's url. Redirect/callback url is the url where the users will be redirected when the users of you site successfully login. Add the redirect/callback url on your facebook app here: 1) go to https://developers.facebook.com 2) login and select your app from my apps. 3) from the left side menu (which has dashboard, setting, etc) see under products, you will Facebook login 4) open facebook login and add redirect url(s) under Valid OAuth redirect URIs