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

Bad request does not raise error #432

Closed
Schwankenson opened this issue Apr 14, 2018 · 2 comments
Closed

Bad request does not raise error #432

Schwankenson opened this issue Apr 14, 2018 · 2 comments
Assignees
Milestone

Comments

@Schwankenson
Copy link

I found out the reason for the strange Wordpress user from the ticket: https://support.auth0.com/tickets/37419 - The non interactive client I used had no permissions selected.

The bug in the Wordpress Plugin is, that it did not show me an error message. Here is what I found out:

In file lib/WP_Auth0_LoginManager.php the request "WP_Auth0_Api_Client::get_user(...)" in line 252 returns an error:

object(stdClass)#6943 (4) { ["statusCode"]=> int(400) ["error"]=> string(11) "Bad Request" ["message"]=> string(37) "Bad HTTP authentication header format" ["errorCode"]=> string(6) "Bearer" }

After the request, there is the line: "if ( $response instanceof WP_Error ) {", but the error is not detected as instance of WP_Error, so it is not raised. So the Plugin just continues to login the user. Because the Wordpress User does not exist, it tries to create one, with dummy data added in "lib/WP_Auth0_Users.php". line 9, because userinfo is empty because of the bad request.

@joshcanhelp joshcanhelp self-assigned this Apr 15, 2018
@joshcanhelp joshcanhelp added this to the v3-Next milestone Apr 16, 2018
@joshcanhelp
Copy link
Contributor

Thanks for the issue report here, @Schwankenson!

We've been working on the next version of the plugin and one of the big things we concentrated on was error handling. In this particular case, we'll catch if the client is not configured properly and fallback to the /userinfo endpoint with the access token:

https://github.com/auth0/wp-auth0/blob/dev/lib/WP_Auth0_LoginManager.php#L254

I'll leave this open and close when it's ready for release (and of April/early May).

@joshcanhelp
Copy link
Contributor

Fixed with #409 and merged into dev

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants