Skip to content

LinkedIn login failure: Flag to skip verifying nonce #763

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

Open
t-o-o-m opened this issue Apr 28, 2025 · 0 comments
Open

LinkedIn login failure: Flag to skip verifying nonce #763

t-o-o-m opened this issue Apr 28, 2025 · 0 comments
Labels
client Concerns a client implementation

Comments

@t-o-o-m
Copy link

t-o-o-m commented Apr 28, 2025

Is your feature request related to a problem? Please describe.

A while ago this issue was resolved: #259

I am now facing a similar problem with LinkedIn, where the ID token in the response does not contain the nonce, hence the validation fails with authlib.jose.errors.MissingClaimError: missing_claim: Missing 'nonce' claim at claims.validate(leeway=leeway) in base_client/async_openid.py when calling authorize_access_token(request)

See https://stackoverflow.com/questions/76889585/issues-with-sign-in-with-linkedin-using-openid-connect

Describe the solution you'd like

I'd like to be able to easily switch off nonce validation, similar to the Apple solution listed above, but not depending on any claims, but easily configurable with e.g. a parameter in oauth.register calls.

Describe alternatives you've considered

I tried subclassing StarletteOAuth2App to exchange AsyncOpenIDMixin with a version without nonce validation but found no way to actually get authlib to use these.

I also tried compliance_fix with register_compliance_hook('access_token_response', remove_nonce_check) but I found no way to modify the response in a way that is useful here.

Another thing I tried was an OAuth2 flow (no OIDC), but this was deprecated by LinkedIn a while ago.

I finally succeeded by setting nonce to None in this session state object: f"_state_linkedin_{request.query_params.get("state")}" but I'd rather have a switch than having to modify the session.
The best scenario would obviously be for LinkedIn to follow OIDC specifications...

@azmeuk azmeuk added bug client Concerns a client implementation and removed bug labels Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Concerns a client implementation
Projects
None yet
Development

No branches or pull requests

2 participants