sfc_remote & malformed access token
I have a problem, I’m trying to use sfc_remote to get some extra details for a user. The problem is that with your default code, to get the user email it doesn’t work.
$data = sfc_remote($fbuid, '', array( 'fields'=>'email', 'code'=>$cookie['code'], )); print_r($data);
The curious part is that the login works. But print_r($data); returns an FB error that I have an malformed access token, after a little more investigation I realized that the access token returned from your sfc_remote function returns me something like
And afterwords the function will try to use the acces_token, it encodes the $expires=4866 and that’s how I get a malformed url.
I hacked you sfc_base.php and at sfc_remote, at line 407 after
$args['access_token'] = str_replace('access_token=','',$resp['body']);
I added an explode
$at = explode("&", $args['access_token']); $args['access_token'] = $at;
This fixes the issue, and I was wondering how the rest is working if this is broken, or if there are other solutions… Or if this is the case to more people, maybe push a repair 🙂
The main reason why I wanted this to work is to make the function
do_action('sfc_login_new_fb_user'); // TODO hook for creating new users if desired
to auto-register users with login without passing through the register page. After I’m done, I’ll come back to share the snippet.
- The topic ‘sfc_remote & malformed access token’ is closed to new replies.