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

How do I retrieve the data for this plugin? #8

Open
ghost opened this issue Aug 8, 2014 · 1 comment
Open

How do I retrieve the data for this plugin? #8

ghost opened this issue Aug 8, 2014 · 1 comment

Comments

@ghost
Copy link

ghost commented Aug 8, 2014

I installed the Google Opauth Strategy and it's working brilliantly. The LinkedIn one acts a little differently; in the directions for this strategy it specifies that no OAuth Redirect URL is needed (on the LinkedIn Developer website). I tried leaving this out, and kept getting this error:

'Invalid redirect_uri. This value must match a URL registered with the API Key.'

This error is also on the demo for the plugin here: http://opauth.org/#demo

So I changed it up a bit and placed my redirect URL there just in case, like my Google one has, and it seemed to have worked! It took me to the LinkedIn login screen, I put in my credentials, and it redirected me back to my application. The trouble is, no data was returned this time.

My defaults in LinkedInStrategy.php looks like this:

public $defaults = array(
'redirect_uri' => 'http://localhost/users/login',
'response_type' => 'code',
'scope' => 'r_fullprofile r_emailaddress r_contactinfo'
);

In my controller I have this:

$_SESSION['log'] = $this->data;

In my view I have this:

debug($_SESSION['log']);

This is just to see if the data is setting. When I log in with GoogleStrategy.php settings, it returns all of the data and I use it to log me in. Perfect. But with this one, I just get empty arrays. Has something changed?

@ghost
Copy link
Author

ghost commented Aug 8, 2014

I solved it! I changed the redirect_uri back to default:

'redirect_uri' => '{complete_url_to_strategy}oauth2callback',

In the LinkedIn Developer API area, I placed this URL in the OAuth 2.0 Redirect URLs:

http://example.com/auth/linkedin/oauth2callback

So the OAuth Redirect URL DOES need to be set, unlike what's stated in the instructions:

'2. Create LinkedIn application at https://www.linkedin.com/secure/developer

    Enter your domain at JavaScript API Domain
    There is no need to enter OAuth Redirect URL'

Furthermore, it specifically has to be http://www.example.com/auth/linkedin/oauth2callback, unless I customize the files further. Either way, you can mark this as solved!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants