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

Feature : Requesting claims using the claims request parameter #308

Closed
tauinger-de opened this issue Sep 25, 2019 · 6 comments
Closed

Feature : Requesting claims using the claims request parameter #308

tauinger-de opened this issue Sep 25, 2019 · 6 comments
Assignees
Labels

Comments

@tauinger-de
Copy link

tauinger-de commented Sep 25, 2019

Need claims in addition to scopes for OpenID Connect

Description

I am trying hard to get Twitch setup as an identity provider. However (as discussed in https://discuss.dev.twitch.tv/t/openid-connect-issues-using-fusionauth-scopes-are-not-provided/22627/3) Twitch doesn't support any other scope than "openid". To get access to the essential "email" claim this must be requested with another "claims" parameter such as &claims={"id_token":{"email":null,"email_verified":null},"userinfo":{"picture":null}}

To me it seems that Fusionauth does not support this -- which would mean that I cannot employ Twitch as a provider :(

Is there a workaround for this?

Related Specification

https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims section 5.5

@robotdan
Copy link
Member

From what I understand from reading that thread is that the user:read:email scope (for example) will ensure that the JWT they send us back has enough privilege to read the user's email address when we request it from the User endpoint. ( https://api.twitch.tv/helix/users )

Here is the configuration I'm using
Twitch OpenID Connect discovery : https://id.twitch.tv/oauth2/.well-known/openid-configuration

Authorization https://id.twitch.tv/oauth2/authorize
Token: https://id.twitch.tv/oauth2/token
Userinfo : https://id.twitch.tv/oauth2/userinfo

When you configure the Twitch IdP you can either just specify https://id.twitch.tv/oauth2 as the issuer and we'll discover all of the endpoints, or you can manually enter each URL.

I can confirm that the Userinfo endpoint is not returning the email claim. Here the JSON response from Twitch.

{
  "aud" : "nxbhe55gj9twb9ld1q5j1pxrll4gmb",
  "exp" : 1569439555,
  "iat" : 1569438655,
  "iss" : "https://id.twitch.tv/oauth2",
  "nbf" : null,
  "sub" : "464160060",
  "jti" : null,
  "azp" : "nxbhe55gj9twb9ld1q5j1pxrll4gmb",
  "preferred_username" : "robotdan_fa"
}

Here is my configuration :

Screen Shot 2019-09-25 at 1 08 33 PM

This is sort of strange because email is a registered OpenId Connect claim. I'll have to look at their documentation further to see if there is a way to request the email address.

@robotdan
Copy link
Member

It does look like they document the claims parameter as was mentioned in the thread you posted.

https://dev.twitch.tv/docs/authentication/getting-tokens-oidc/#oidc-authorization-code-flow

This page lists out the default claims returned in the Userinfo response, this is consistent with what I'm seeing. https://dev.twitch.tv/docs/authentication/getting-tokens-oidc/#claims

According to their documentation, we would have to append another parameter to the request to Userinfo.

claims={"userinfo":{"email":null}}

We don't currently support adding additional request parameters to these requests.

This is a documented optional method to allow the caller to request particular claims. It is documented in section 5.5 in the OpenID Connect core spec. https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims

We could look at adding this capability so that we can work with Twitch and any other OIDC provider that may utilize this methodology.

@robotdan robotdan changed the title Need claims in addition to scopes for OpenID Connect Feature : Requesting claims using the claims request parameter Sep 25, 2019
@robotdan robotdan self-assigned this Sep 25, 2019
@robotdan
Copy link
Member

@tauinger-de I may have an easy fix for you.

As a test, I made a small change to the way we call the Authorize endpoint to allow request parameters to be added to the configured URL.

This way, I configured my Twitch IdP as follow for the Authorization endpoint:

https://id.twitch.tv/oauth2/authorize?claims=%7B%22userinfo%22%3A%7B%22email%22%3Anull%7D%7D

I added ?claims=%7B%22userinfo%22%3A%7B%22email%22%3Anull%7D%7D to the end of the endpoint to force this parameter on the request. %7B%22userinfo%22%3A%7B%22email%22%3Anull%7D%7 is the following JSON encoded {"userinfo":{"email":null}}.

We should probably support the claims request parameter configuration at some point, but I can ship this minor change in the upcoming patch release. I have verified this will work for a Twitch login.

Looks for Twitch to work in the upcoming patch release.

@tauinger-de
Copy link
Author

Good morning, that sounds great! Thanks heaps for your efforts. Have you got a release date in mind?

@robotdan
Copy link
Member

robotdan commented Sep 26, 2019

Opening a separate issue to track this small fix to make Twitch work with our current OpenId Connect configuration. We can use this issue to track the feature to add support for the claims request parameter during an Authorization request.

Issue #309

Good morning, that sounds great! Thanks heaps for your efforts. Have you got a release date in mind?

You're welcome. No date in mind, there are few minor fixes that I could probably get out in a small release. Maybe yet this week? Do you have an ideal timeline in mind?

@andrewpai
Copy link

Closing this issue, as it seems to be covered by #309 .

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

No branches or pull requests

3 participants