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: could not get profile id: could not find 'id' in result #4421

Closed
3 of 4 tasks
stefanlogue opened this issue Nov 11, 2023 · 10 comments · Fixed by #4428
Closed
3 of 4 tasks

linkedin: could not get profile id: could not find 'id' in result #4421

stefanlogue opened this issue Nov 11, 2023 · 10 comments · Fixed by #4428
Assignees
Labels
bug Something isn't working

Comments

@stefanlogue
Copy link

What happened?

Trying to use the LinkedIn announce feature, I've supplied my access token in my workflow and passed it to the Github Action. The releases all pass, then the announce fails with the error in the title. Am I doing something wrong, or is there any further setup that needs to be done on my side for this to work? The docs for this were pretty lacking

How can we reproduce this?

https://github.com/stefanlogue/meteor

My public repo that reproduces the issue currently

goreleaser version

1.22.1

GoReleaser Check

  • goreleaser check shows no errors

Search

  • I did search for other open and closed issues before opening this

Supporter

Code of Conduct

  • I agree to follow this project's Code of Conduct

Additional context

No response

@stefanlogue stefanlogue added bug Something isn't working triage Issue pending triage by one of the maintainers labels Nov 11, 2023
@caarlos0
Copy link
Member

hmm, maybe linkedin changed their API 🤔

cc/ @Dentrax

@caarlos0 caarlos0 removed the triage Issue pending triage by one of the maintainers label Nov 13, 2023
@stefanlogue
Copy link
Author

For what it's worth, I tried to hit the /v2/me endpoint using the same access token in Postman, and got an error that I didn't have the required permissions, even though I've got the scopes for signing in with OAuth and for sharing posts. The scopes I've got are:
openid, profile, w_member_social and email if that helps

@gabrielcipriano
Copy link
Contributor

It looks like that you need one of the following scopes to hit /v2/me

Permission | Description
r_liteprofile Required to retrieve name and photo for the authenticated user. Please review Lite Profile Fields.
r_basicprofile Required to retrieve name, photo, headline, and vanity name for the authenticated user. Please review Basic Profile Fields. Note that the v2 r_basicprofile permission grants only a subset of fields provided in v1.

https://learn.microsoft.com/en-us/linkedin/shared/integrations/people/profile-api#permissions

@stefanlogue
Copy link
Author

@gabrielcipriano any idea how to get any of these permissions? The dashboard for adding permissions doesn't allow manually adding them (as far as I can see) and you need to do it through the process of adding "Products" to your app, which then add relevant scopes (although this is quite opaque, it doesn't say which scopes will be added for each Product).

It looks like they've made it more difficult to request scopes.

@gabrielcipriano
Copy link
Contributor

hey @stefanlogue, I found this discussion and @caarlos0 is right, they changed their api. They deprecated /v2/me in favor of v2/userinfo, so new applications will not have old permissions such as r_liteprofile.

v2/userinfo needs the new permission profile

I will open a PR with the needed changes.

caarlos0 pushed a commit that referenced this issue Nov 18, 2023
Closes #4421 

I chose to keep `getProfileID` as `getProfileIDLegacy` and use it as a
fallback if `getProfileSub` fails because of permission scope.

In this way, it's not a breaking change because one that has only a
deprecated permissions such as `r_liteprofile` will still be able to hit
`v2/me`

this logic is encapsulated in the new function `getProfileURN`, that
resolves the user identifier and returns it formatted as a URN

---------

Co-authored-by: Gabriel F Cipriano <gabriel.cipriano@farme.com.br>
@stefanlogue
Copy link
Author

Thanks for this, all working as expected now!

@stefanlogue
Copy link
Author

Got another error with this recently:

linkedin: could not get profile URN: could not get profile sub: could not find 'sub' in result: %!w(<nil>)

Havent't changed anything since it was previously working

caarlos0 added a commit that referenced this issue Feb 2, 2024
@caarlos0
Copy link
Member

caarlos0 commented Feb 2, 2024

:pain:

did they change their api again?

PS: I fixed the issue in the error message (the nil error %w thing)

@stefanlogue
Copy link
Author

Is there a way to have the action step still pass after the announce fails? I'd love to continue to test this out on my project but don't want the whole action to fail if this fails as it's not really overly important, the tool is still released on homebrew by this stage

@caarlos0
Copy link
Member

caarlos0 commented Feb 3, 2024

currently it isn't, but maybe we could add a allow_failure or something like that to the config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants