GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Linkedin: Migrate to versioned APIs · Issue #1058 · scribejava/scribejava

Linkedin: Migrate to versioned APIs #1058

New issue
Copy link
New issue
Copy link
Open
Open
Linkedin: Migrate to versioned APIs#1058
Copy link

Description

@peternees
peternees
opened on Apr 26, 2023
Issue body actions

Linkedin changes to versioned api. See: https://learn.microsoft.com/en-us/linkedin/marketing/versioning?trk=eml-mktg-cust-202304-global-api-migrations-june&mcid=7054174543908663296&src=e-eml&view=li-lms-2023-04

This has some impact.

1.Change needed to OAuth20Service

final OAuth20Service service = new ServiceBuilder(clientId)
                .apiSecret(clientSecret)
                .defaultScope(new ScopeBuilder("r_liteprofile", "r_emailaddress"))
                .callback("http://example.com/callback")
                .build(LinkedInApi20.instance());

a. LinkedInApi20 need different endpoints: change v2 to rest

    public String getAccessTokenEndpoint() {
        return "https://www.linkedin.com/oauth/**rest**/accessToken";
    }

    protected String getAuthorizationBaseUrl() {
        return "https://www.linkedin.com/oauth/**rest**/authorization";
    }

This could be solved by using an extention of LinkedInApi20 with the rest endpoint. But it is better that LinkedInApi20 gets updated.

b. the oauth request need to get a version header. I think for this, scribejava lib needs a change

  1. Change to Resource api. This is easy and does not require a change of the scribeapi.

In the example https://github.com/scribejava/scribejava/blob/master/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/LinkedIn20Example.java change the resource endpoint:
now:
```
private static final String PROTECTED_RESOURCE_URL = "https://api.linkedin.com/v2/me";
private static final String PROTECTED_EMAIL_RESOURCE_URL
= "https://api.linkedin.com/v2/emailAddress?q=members&projection=(elements*(handle~))";


chage to
private static final String PROTECTED_RESOURCE_URL = "https://api.linkedin.com/**rest**/me";
private static final String PROTECTED_EMAIL_RESOURCE_URL
        = "https://api.linkedin.com/**rest**/emailAddress?q=members&projection=(elements*(handle~))";
..
final OAuthRequest request = new OAuthRequest(Verb.GET, PROTECTED_RESOURCE_URL);
**request.addHeader("LinkedIn-Version", "202304");**
Reacted by Erik C. Thauvin

Activity

  1. peternees commented on Apr 26, 2023

    @peternees
    peternees
    on Apr 26, 2023
    Author
    More actions

    After testing, some additional info (I should have done that before creating the issue):

    • https://www.linkedin.com/oauth/rest/authorization does not work. This URL is used with a redirect in the Browser, this is not realy an api request on which you can add headers. I guess/hope this remains v2.
    • https://api.linkedin.com/rest/emailAddress?q=members&projection=(elements*(handle~)) does not work. It returns {"status":404,"code":"RESOURCE_NOT_FOUND","message":"No virtual resource found"}. The v2 end point is still valid: https://api.linkedin.com/v2/emailAddress?q=members&projection=(elements*(handle~))"; I don't know if this will change.

    So it seems that, for the moment, only the profile api (/me) should change to https://api.linkedin.com/rest/me with version header.

    So no need for a change in the lib, but for the linkedin example.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.