-
Notifications
You must be signed in to change notification settings - Fork 474
fix(shared): type JWT aud as string or string array #9585
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
Changes from all commits
5f57241
4cef528
0c52c1b
0f9e706
0769cad
91cdb88
b40da6d
0d3bfad
8c62389
f4f22e4
e737f3c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@clerk/backend': minor | ||
| --- | ||
|
|
||
| Expose the optional `aud` audience on verified OAuth access tokens. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ import type { JwtPayload } from '@clerk/shared/types'; | |
| import type { IdPOAuthAccessTokenJSON } from './JSON'; | ||
|
|
||
| type OAuthJwtPayload = JwtPayload & { | ||
| aud?: string | string[]; | ||
| jti?: string; | ||
| client_id?: string; | ||
| scope?: string; | ||
|
|
@@ -25,6 +26,8 @@ export class IdPOAuthAccessToken { | |
| readonly createdAt: number, | ||
| /** The Unix timestamp (in milliseconds) when the access token was last updated. */ | ||
| readonly updatedAt: number, | ||
| /** The intended audience for the access token. */ | ||
| readonly aud?: string | string[], | ||
| ) {} | ||
|
|
||
| static fromJSON(data: IdPOAuthAccessTokenJSON) { | ||
|
|
@@ -40,6 +43,7 @@ export class IdPOAuthAccessToken { | |
| data.expiration, | ||
| data.created_at, | ||
| data.updated_at, | ||
| data.aud, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [MEDIUM] The opaque This line makes A resource server B that calls Running the returned — Comment generated 🤖 with @dominic-clerk's supervision ( |
||
| ); | ||
| } | ||
|
|
||
|
|
@@ -63,6 +67,7 @@ export class IdPOAuthAccessToken { | |
| payload.exp * 1000, // milliseconds: expiration, converted from JWT exp claim | ||
| payload.iat * 1000, // milliseconds: createdAt, converted from JWT iat claim | ||
| payload.iat * 1000, // milliseconds: updatedAt, no JWT equivalent, defaults to iat | ||
| oauthPayload.aud, | ||
| ); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.