Auth0 Home Blog Docs

Can't access user data in Wordpress

wordpress
wordpress-login-with

#1

I’m using the Auth0 wordpress plugin 3.4.0, but having a few issues. Here’s the first one I’m trying to solve:

  1. We create new users via the Auth0 Management API via a separate signup app.
  2. To give the user access to their account, we send a passwordless login link to the user, which then redirects them to the Wordpress site.
  3. The user is successfully logged in to Wordpress; an account is created for them, but has the default ‘change_this_email@’ address, implying no user data was passed across.
  4. When we try to use the ‘get_currentauth0userinfo’ method in the wpa0_user_created hook, we can’t access the API. The resulting object is below:

stdClass Object
(
[statusCode] => 401
[error] => Unauthorized
[message] => Invalid token
[attributes] => stdClass Object
(
[error] => Invalid token
)
)

I suspect that the app is successfully validating the auth code supplied after auth0 login (because a new blank user is created), but is then failing to exchange that for an access token for further communication with the app. I’m missing something, but I’m not sure what it could be. Any ideas?


#2

We’ve verified that the JWT available in Wordpress has good data in it, and has the right signature.


#3

We’ve been looking at scopes. The passwordless login link has the scopes “openid profile email” by default. We’ve tried adding “read:users” in order to be able to access the management API, but no difference.


#4

Hi! We’re currently fixing bugs on the Wordpress SDK and a new version shall be released before EOW. Apologies for the inconvenience caused. Any feedback, in the meantime, is more than welcomed.


#5

We’re trying to use the dev HEAD at the moment, but not having any luck yet. We’ll report back with what we find.


#6

OK, we’ve switched to using the dev branch of the wp-auth0 plugin, and basic user data is now working, which is brilliant. Looks like it was a problem in 3.4.0 which has been resolved. We have some more issues to work through, but it look like that’s the big one sorted. Thanks!


#7

OK, we’ve switched to using the dev branch of the wp-auth0 plugin, and basic user data is now working, which is brilliant. Looks like it was a problem in 3.4.0 which has been resolved. We have some more issues to work through, but it look like that’s the big one sorted. Thanks!


#8

Hi @floppy: here’s the official 3.5.0 release :slight_smile:


#9

Thanks! We’ve got it installed and it’s working much better :slight_smile: