Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling Invalid Client ID and Secret Exception #1391

Open
dbjpanda opened this issue Nov 6, 2023 · 0 comments
Open

Handling Invalid Client ID and Secret Exception #1391

dbjpanda opened this issue Nov 6, 2023 · 0 comments

Comments

@dbjpanda
Copy link

dbjpanda commented Nov 6, 2023

When attempting to log in with invalid credentials (Incorrect Client ID or Secret), the expected behavior is to through an exception.

I was trying to create an Login Ouath for Github. By providing incorrect credentials. the application redirects me to 404 error page on GitHub without logging any exceptions.

public function handle_social_login($provider) {

    $config = $this->get_config($provider);
    $hybridauth = new Hybridauth($config);

    try {
        $hybridauth->authenticate($provider);
    }
    catch (Exception\AuthorizationDeniedException $e) {
        write_log('User denied the authentication/authorization request.');
    }
    catch (Exception\HttpClientFailureException $e) {
        write_log('Error in client: Network issues or server configuration problems.');
    }
    catch (Exception\HttpRequestFailedException $e) {
        write_log('Error in request: Requested URL returned errors.');
    }
    catch (Exception\InvalidApplicationCredentialsException $e) {
        write_log('Invalid application credentials.');
    }
    catch (Exception\InvalidAuthorizationCodeException $e) {
        write_log('Invalid OAuth2 authorization code.');
    }
    catch (Exception\InvalidAuthorizationStateException $e) {
        write_log('Invalid or used OAuth2 authorization state.');
    }
    catch (Exception\InvalidOauthTokenException $e) {
        write_log('Invalid OAuth1 oauth_token.');
    }
    catch (Exception\InvalidAccessTokenException $e) {
        write_log('Invalid OAuth1 access_token.');
    }
    catch (Exception\InvalidOpenidIdentifierException $e) {
        write_log('Invalid OpenID identifier.');
    }
    catch (Exception\UnexpectedApiResponseException $e) {
        write_log('Unexpected response from the API.');
    }
    catch (Exception\NotImplementedException $e) {
        write_log('Requested method or operation not implemented.');
    }
    catch (Exception\BadMethodCallException $e) {
        write_log('Callback refers to an undefined method or missing arguments.');
    }
    catch (Exception\UnexpectedValueException $e) {
        write_log('Value doesn\'t match with a set of values.');
    }
    catch (Exception\RuntimeException $e) {
        write_log('Runtime error.');
    }
    catch (Exception\InvalidArgumentException $e) {
        write_log('Argument not of the expected type.');
    }
    catch (\Exception $e) {
        // Generic catch-all
        write_log($e->getMessage());
    }
}

None of the exception caught.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant