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

JWT authentication issue #630

Open
jmrbcu opened this issue Feb 22, 2024 · 3 comments
Open

JWT authentication issue #630

jmrbcu opened this issue Feb 22, 2024 · 3 comments

Comments

@jmrbcu
Copy link

jmrbcu commented Feb 22, 2024

I need to authenticate with Ring Central JWT workflow. How to use Authlib for this case? I am unable to find how to do something like this in the documentation:

Request: POST

Headers:
Content-type: application/x-www-form-urlencoded
Authorization: Basic + base64_encoded( Client ID + ":" + Client Secret )

Body:

grant_type: urn:ietf:params:oauth:grant-type:jwt-bearer.
assertion: JWT token.

Docs: https://developers.ringcentral.com/guide/authentication/jwt-flow

@jmrbcu
Copy link
Author

jmrbcu commented Feb 22, 2024

This is the only way I've been able to do it:

session = OAuth2Session(self.client_id, self.client_secret)
session.fetch_token(urljoin(self.base_url, TOKEN_ENDPOINT), grant_type="urn:ietf:params:oauth:grant-type:jwt-bearer", assertion=jwt)

@jlambright
Copy link

I'm in the same boat, and it seems like the AssertionClient and AsyncAssertionClient don't take a signed jwt or even take in the private key. How is this supposed to work?

https://github.com/lepture/authlib/blob/master/authlib/integrations/httpx_client/assertion_client.py

@jlambright
Copy link

jlambright commented Feb 29, 2024

We were able to track down some implied keywords through reading the source code, but it didn't work.

self.assertion_client = AsyncAssertionClient(
                token_endpoint=f'https://{REDACTED_VARIABLE_1}/oauth/v2/token',
                subject=REDACTED_VARIABLE_2,
                issuer=REDACTED_VARIABLE_2,
                audience=f'https://{REDACTED_VARIABLE_1}',
                grant_type='urn:ietf:params:oauth:grant-type:jwt-bearer',
                token_placement='body',
                claims=self.scopes,
                header=REDACTED_VARIABLE_3,
                key=REDACTED_VARIABLE_4

            )

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

No branches or pull requests

2 participants