How to change oAuth Scope when using LinkedIn API Console

Not applicable

I would like to call methods on https://apigee.com/console/linkedin but with the oAuth scope set to `r_basicprofile`. Is it possible to change that?

Thanks in advance

Solved Solved
1 5 6,847
1 ACCEPTED SOLUTION

@Marcus Zanona ,

Great Question & Welcome to Apigee Community 🙂

OAuth Scope is selected while creating Applications in LinkedIn. It's configured while creating togo console. It's not available part of console due to reason mentioned below.

Since LinkedIn Console APP is a developer console app with all APIs, It is registered in LinkedIn with all scopes so that LinkedIn App Developers can play will all the APIs instead of restricted APIs access. If we restrict scope to 'r_basic_profile' then some of the APIs won't work.

Do you know that you can build your own Apigee Console ?

If you would like to change the scope to 'r_basic_profile 'only then I would suggest creating your own console & app in LinkedIn with the restricted scopes you would like to.

How to do same ?

Step 1: Register your App in LinkedIn with scope & get Keys

2258-screen-shot-2016-03-26-at-82619-pm.png

Step 2: Get Keys from above created linkedin App

2259-screen-shot-2016-03-26-at-94623-pm.png

Step 3:

Navigate to https://apigee.com/togo to create new Apigee Console , Use Client ID & Secret from above step.

2260-apigee-console-to-go.png

See below sample wadl with few linkedin APIs that should be uploaded in Upload WADL section,

<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

             xmlns:xsd="http://www.w3.org/2001/XMLSchema"

             xmlns:apigee="http://api.apigee.com/wadl/2010/07/"

             xmlns="http://wadl.dev.java.net/2009/02"

             xsi:schemaLocation="http://wadl.dev.java.net/2009/02 http://apigee.com/schemas/wadl-schema.xsd http://api.apigee.com/wadl/2010/07/ http://apigee.com/schemas/apigee-wadl-extensions.xsd">




    <!-- Base defines the domain and base path of the endpoint -->

    <resources base="https://api.linkedin.com/v1">

        

        <resource path="people/~">

            <method id="profile_api" name="GET">

                <apigee:tags>

                    <apigee:tag primary="true">1. Profile</apigee:tag>

                </apigee:tags>

                <apigee:authentication required="true" />

                <apigee:example url="/people/~" />

                <doc title="" apigee:url="http://developer.linkedin.com/docs/DOC-1002"><![CDATA[

                    The Profile API returns a member's LinkedIn profile. Use the tilde character to indicate that you want the profile of the current	user. The access token will be used to determine the profile to	return.

                ]]></doc>

            </method>

        </resource>

        

        <resource path="people/id">

            <method id="profile_id_api" name="GET">

                <apigee:tags>

                    <apigee:tag primary="true">1. Profile</apigee:tag>

                </apigee:tags>

                <apigee:authentication required="true" />

                <apigee:example url="/people/id={id}" />

                <doc title="" apigee:url="http://developer.linkedin.com/docs/DOC-1002"><![CDATA[

                    The Profile API returns a member's LinkedIn profile. If you know the member token of the profile you want to display, you can use it as the key value for this API call. You should include id= to indicate that you are using a member token. Requesting by member token only returns a profile from the logged in person's three degree network and doesn't return any out-of-network profiles. You cannot use a member token to get a public profile. To see just a thumbnail version of the profile, do not include anything after the	profile key value. To select your own fields, use the field selector notation- :(field1,field2,field3...). When using field selectors, all fields must be at the same level of depth in the XML

                ]]></doc>

            </method>

        </resource>

    </resources>




</application>

Step 4:

Authorization url in step 3 should be,

https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=CLIENTIDFROMSTEP2&red...

Step 5 :

Go back to linkedin App in Step 2, Add OAUTH2.0 Redirect URL. You can get redirect URL from Step 3 in Apigee console.

Step 6 :

Save settings & navigate to new console that demonstrates 'r_basic_profile' oAuth Scope.

2261-screen-shot-2016-03-26-at-90603-pm.png

I have created a console which demonstrates same. See console here (https://apigee.com/asagar/embed/console/basic-linkedin) which i have created following above steps.

View solution in original post

5 REPLIES 5

I think you may have to register a developer app on Linkedin before you can issue requests to their API. See the OAuth 2.0 Linkedin developer documentation for details.

I am not sure @swilliams all the calls are already effectively performed. It seems any user can simply authenticate using their own account and the developer app here being using is Apigee Console.

@Marcus Zanona ,

Great Question & Welcome to Apigee Community 🙂

OAuth Scope is selected while creating Applications in LinkedIn. It's configured while creating togo console. It's not available part of console due to reason mentioned below.

Since LinkedIn Console APP is a developer console app with all APIs, It is registered in LinkedIn with all scopes so that LinkedIn App Developers can play will all the APIs instead of restricted APIs access. If we restrict scope to 'r_basic_profile' then some of the APIs won't work.

Do you know that you can build your own Apigee Console ?

If you would like to change the scope to 'r_basic_profile 'only then I would suggest creating your own console & app in LinkedIn with the restricted scopes you would like to.

How to do same ?

Step 1: Register your App in LinkedIn with scope & get Keys

2258-screen-shot-2016-03-26-at-82619-pm.png

Step 2: Get Keys from above created linkedin App

2259-screen-shot-2016-03-26-at-94623-pm.png

Step 3:

Navigate to https://apigee.com/togo to create new Apigee Console , Use Client ID & Secret from above step.

2260-apigee-console-to-go.png

See below sample wadl with few linkedin APIs that should be uploaded in Upload WADL section,

<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

             xmlns:xsd="http://www.w3.org/2001/XMLSchema"

             xmlns:apigee="http://api.apigee.com/wadl/2010/07/"

             xmlns="http://wadl.dev.java.net/2009/02"

             xsi:schemaLocation="http://wadl.dev.java.net/2009/02 http://apigee.com/schemas/wadl-schema.xsd http://api.apigee.com/wadl/2010/07/ http://apigee.com/schemas/apigee-wadl-extensions.xsd">




    <!-- Base defines the domain and base path of the endpoint -->

    <resources base="https://api.linkedin.com/v1">

        

        <resource path="people/~">

            <method id="profile_api" name="GET">

                <apigee:tags>

                    <apigee:tag primary="true">1. Profile</apigee:tag>

                </apigee:tags>

                <apigee:authentication required="true" />

                <apigee:example url="/people/~" />

                <doc title="" apigee:url="http://developer.linkedin.com/docs/DOC-1002"><![CDATA[

                    The Profile API returns a member's LinkedIn profile. Use the tilde character to indicate that you want the profile of the current	user. The access token will be used to determine the profile to	return.

                ]]></doc>

            </method>

        </resource>

        

        <resource path="people/id">

            <method id="profile_id_api" name="GET">

                <apigee:tags>

                    <apigee:tag primary="true">1. Profile</apigee:tag>

                </apigee:tags>

                <apigee:authentication required="true" />

                <apigee:example url="/people/id={id}" />

                <doc title="" apigee:url="http://developer.linkedin.com/docs/DOC-1002"><![CDATA[

                    The Profile API returns a member's LinkedIn profile. If you know the member token of the profile you want to display, you can use it as the key value for this API call. You should include id= to indicate that you are using a member token. Requesting by member token only returns a profile from the logged in person's three degree network and doesn't return any out-of-network profiles. You cannot use a member token to get a public profile. To see just a thumbnail version of the profile, do not include anything after the	profile key value. To select your own fields, use the field selector notation- :(field1,field2,field3...). When using field selectors, all fields must be at the same level of depth in the XML

                ]]></doc>

            </method>

        </resource>

    </resources>




</application>

Step 4:

Authorization url in step 3 should be,

https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=CLIENTIDFROMSTEP2&red...

Step 5 :

Go back to linkedin App in Step 2, Add OAUTH2.0 Redirect URL. You can get redirect URL from Step 3 in Apigee console.

Step 6 :

Save settings & navigate to new console that demonstrates 'r_basic_profile' oAuth Scope.

2261-screen-shot-2016-03-26-at-90603-pm.png

I have created a console which demonstrates same. See console here (https://apigee.com/asagar/embed/console/basic-linkedin) which i have created following above steps.

@Anil Sagar thanks so much for the thorough guide Anil. You are appreciated. I didn't know I could create my own console on Apigee, that's really great. Also thanks for sharing your example and the URL to it, I have managed to use it already.

@Marcus Zanona , Awesome, Glad your query is resolved. Your question actually helped me to learn some new things about console. Keep us posted if you have any queries moving forward. Just FYI, Apigee main product is Apigee Edge Intelligent API platform using which you can build API proxies & build API Eco System. If you are interested, Check out our docs.