adamwathan / eloquent-oauth

Braindead simple social login with Laravel and Eloquent.
370 stars 44 forks source link

Not catching ApplicationRejectedException when user reject facebook login #69

Closed mak1986 closed 9 years ago

mak1986 commented 9 years ago

I'm getting an error page showing that an ApplicationRejectedException has been thrown. Am I doing anything wrong here? It catches the exception when I do the catch on runtimeException.

screencapture-localhost-gu-public-facebook-login-1433529557920

Here's my code

Route::get('{oauth}/login', function($oauth) {
    try {
        OAuth::login($oauth);
    } catch (ApplicationRejectedException $e) {
        echo "in ApplicationRejectedException";
        die();
    } catch (InvalidAuthorizationCodeException $e) {
        // Authorization was attempted with invalid
        // code,likely forgery attempt
    }
   //catch(\RuntimeException $e){
   //     echo "in RuntimeException";
   //     die();
   //}

    // Current user is now available via Auth facade
    $user = Auth::user();

    return Redirect::intended();
});
adamwathan commented 9 years ago

Can you double check that you are importing the ApplicationRejectedException from the correct namespace?

mak1986 commented 9 years ago

Thank you :) It was the namespace.

I changed from use \AdamWathan\EloquentOAuth\Exceptions\ApplicationRejectedException; to use \SocialNorm\Exceptions\ApplicationRejectedException;

and that fixed it.

adamwathan commented 9 years ago

Great! I'll make sure to update the documentation. Thanks!

— Adam

On Fri, Jun 5, 2015 at 3:05 PM, mak1986 notifications@github.com wrote:

Thank you :) It was the namespace. I changed from use \AdamWathan\EloquentOAuth\Exceptions\ApplicationRejectedException; to use \SocialNorm\Exceptions\ApplicationRejectedException;

and that fixed it.

Reply to this email directly or view it on GitHub: https://github.com/adamwathan/eloquent-oauth/issues/69#issuecomment-109400190