I changed:
if ( is_user_logged_in() ) {
wp_safe_redirect( $user_redirect );
exit;
}
to
if ( is_user_logged_in() ) {
wp_safe_redirect( $user_redirect );
exit;
}else{
exit( exit( $user_info->error.' : '.$user_info->error_description ); );
}
and got
invalid_request : Invalid token
Inspecting wp_set_current_user()
I found it returned a WP_Error
with ” Cannot create a user with an empty login name.” Which is to be expected. It should probably check for an OAuth error before trying to make a user.
-
This reply was modified 1 year, 6 months ago by
lordmatt.
-
This reply was modified 1 year, 6 months ago by
lordmatt.
-
This reply was modified 1 year, 6 months ago by
lordmatt. Reason: WP_Error
-
This reply was modified 1 year, 6 months ago by
lordmatt.
I’ve been through “WP OAuth Server” with all the searches I could think of. I have no idea what is going wrong.
From dumping $response
it seems to be sending: https://[snip]...[/snip].com/?oauth=me&access_token=
I have tracked this down to a 502 Bad Gateway
fully formatted HTML reply to the call wp_remote_post( $server_url, array(...) );
. Which might be a bit of an edge case but might be worth testing for.
I propose the following change to callback.php
:
$user_info = json_decode( $response['body'] );
if ( isset($user_info->error) ) {
exit('Something is wrong: '.$user_info->error.' : '.$user_info->error_description);
}
-
This reply was modified 1 year, 6 months ago by
lordmatt.
-
This reply was modified 1 year, 6 months ago by
lordmatt.