Jump to content

Jainrain social login, error in returning Provider Name


herghost

Recommended Posts

Hi Guys

 

I am trying to implement the rpxnow / janrain social login into my site.

 

I am having issues in returning the providername when the user logs in with facebook. Basically the results from janrain are returned as an array.

 

to get the providerid from Google I use this:

 


foreach ($auth_info as $key) {
    
}

$provider = $key['providerName'];

 

which correctly returns "Google", however when the user try's to login with facebook the result is "f" where the array output is "Facebook".

 

Using the demo file for outputting the array, the structure looks like this for google:

 

auth_info:
array(2) {
  ["stat"]=>
  string(2) "ok"
  ["profile"]=> array(10) {
    ["url"]=>
    string(45) "https://plus.google.com/*deleted*"
    ["preferredUsername"]=>
    string(10) "*deleted*"
    ["email"]=>
    string(20) "*deleted*"
    ["name"]=>
    array(3) {
      ["givenName"]=>
      string(4) "Dave"
      ["familyName"]=>
      string(4) "*deleted*"
      ["formatted"]=>
      string(9) "*deleted*"
    }
    ["photo"]=>
    string(169) "http://www.google.com/ig/c/photos/public/*deleted*"
    ["displayName"]=>
    string(9) "*deleted*"
    ["identifier"]=>
    string(53) "https://www.google.com/profiles/*deleted*"
    ["verifiedEmail"]=>
    string(20) "*deleted*"
    ["providerName"]=>
    string(6) "Google"
    ["googleUserId"]=>
    string(21) "*deleted*"
  }
}

 

and like this for facebook

 

auth_info:
array(3) {
  ["stat"]=>
  string(2) "ok"
  ["profile"]=>
  array(12) 
  {
    ["providerName"]=>
    string( "Facebook"
    ["identifier"]=>
    string(48) "http://www.facebook.com/profile.php?id=*deleted*"
    ["preferredUsername"]=>
    string( "*deleted*"
    ["displayName"]=>
    string(9) "*deleted*"
    ["email"]=>
    string(20) "*deleted*"
    ["name"]=>
    array(3) {
      ["formatted"]=>
      string(9) "*deleted*"
      ["givenName"]=>
      string(4) "Dave"
      ["familyName"]=>
      string(4) "*deleted*"
    }
    ["url"]=>
    string(33) "http://www.facebook.com/*deleted*"
    ["photo"]=>
    string(55) "https://graph.facebook.com/*deleted*/picture?type=large"
    ["utcOffset"]=>
    string(5) "01:00"
    ["address"]=>
    array(2) {
      ["formatted"]=>
      string(16) "*deleted*"
      ["type"]=>
      string(15) "currentLocation"
    }
    ["gender"]=>
    string(4) "male"
    ["verifiedEmail"]=>
    string(20) "*deleted*"
  }
  ["limited_data"]=>
  string(5) "false"
}

 

I also tried to use $provider = ['profile']['providerName'] however this returns an error :

PHP Fatal error:  Cannot use string offset as an array

 

How can I correctly return "Facebook"

 

Thanks

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.