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

LinkedIn integration does not support scopes #368

Closed
olivernybroe opened this issue May 31, 2019 · 14 comments
Closed

LinkedIn integration does not support scopes #368

olivernybroe opened this issue May 31, 2019 · 14 comments

Comments

@olivernybroe
Copy link

  • Socialite Version: 4.1
  • Laravel Version: 5.8
  • PHP Version: 7.1

Description:

When using linkedIn with scopes, the scope is requested, however the data is not getting fetched afterwards.
When I for example have the scope r_basicprofile, I should be able to get the vanityName, however this data is not getting fetched.

Looking into the provider, we have a bunch of hardcoded properties, these do not change depending on which scope I am requesting.

Steps To Reproduce:

Make a request with scope r_basicprofile.

@driesvints
Copy link
Member

The problem with the LinkedIn provider is that we specifically need to give it the projection with the fields we need and there isn't an api in Socialite to pass along the requested fields atm. Since Socialite is an abstraction for multiple providers and LinkedIn is the only one who needs this it's a bit hard to build this in. I'm not so sure that we should make changes to provide this feature for just the LinkedIn provider.

@olivernybroe
Copy link
Author

@driesvints what about using the wildcard for field selection with LinkedIn?
You should be able to do v2/me?projection=(*).

@driesvints
Copy link
Member

That would unnecessarily retrieve data for anyone who doesn't needs it.

@smokezp
Copy link

smokezp commented Jun 20, 2019

Hi, I also use LinkedIn. I'm trying to get all the user data.

I use folowing code:

public function redirect($service)
{
return Socialite::driver($service)->scopes(['r_fullprofile'])->redirect();
}

public function callback($service)
{

    try {
        $user = Socialite::with($service)->user();
    } catch (\Throwable $e) {
        dd($e->getMessage());
    }
}

This is what I get:
A required parameter "code" is missing"
https://prnt.sc/o4fjd8

It happens when I use scope "r_fullprofile".
How can I fix this? Is this the same problem?

@4unkur
Copy link

4unkur commented Jun 25, 2019

@smokezp Try to upgrade your laravel-socialite to 4.1 versions. See #309

@tomsisk
Copy link

tomsisk commented Jul 2, 2019

Microsoft makes this difficult to find (and actually quite confusing because r_basicprofile was the default in v1), but are you sure you have access to r_basicprofile? v2 of their API does not give this to you by default, you have to use r_liteprofile.

By default, only the Lite Profile Fields are returned for a profile request.

To request more or less fields, you must have additional permissions that are only granted to select partners.

https://docs.microsoft.com/en-us/linkedin/shared/integrations/people/profile-api#field-selections

You can see your current permissions under the Auth tab of your application at https://www.linkedin.com/developers

@connecteev
Copy link

@olivernybroe does linkedin login work for you, though? It seems like it does but I don't get the user's email address back.
But yes, +1 on adding Linkedin support for scopes as well.

@olivernybroe
Copy link
Author

@connecteev Works fine for me.

@connecteev
Copy link

@olivernybroe that's interesting...I was connecting Laravel Socialite over APIs, but I figured out the problem and the email address comes through now.

@connecteev
Copy link

+1 on the original issue so we can get the vanityName back from Linkedin

@connecteev
Copy link

ANy update on this?

@driesvints
Copy link
Member

@connecteev everyone's free to send in a pr to help solve this problem.

@driesvints driesvints changed the title [LinkedIn] LinkedIn integration does not support scopes LinkedIn integration does not support scopes Oct 28, 2019
@shailesh-jakhaniya
Copy link

Hello @olivernybroe

When you have created the Linkedin app then go to the product tab and select the Sign In with LinkedIn. scope issues auto resolved into any version of the socialite package.

@driesvints
Copy link
Member

When I enable the "Share on LinkedIn" product and try to add the w_member_social scope everything works fine. You need to be an approved developer to be able to use the r_basicprofile scope. See https://docs.microsoft.com/en-us/linkedin/shared/integrations/people/profile-api

return Socialite::driver('linkedin')
            ->scopes(['w_member_social'])
            ->redirect();

Screenshot 2020-06-19 at 17 30 22

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

No branches or pull requests

7 participants