Skip to content

Commit cdfa193

Browse files
authored
Add provider ID token to TokenData type (#1286)
We added this in v6 along with the `identity_id`.
1 parent b93b8d9 commit cdfa193

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

packages/auth-core/src/core.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,14 @@ export class Auth {
6161
return new AuthPCKESession(this, challenge, verifier);
6262
}
6363

64-
getToken(code: string, verifier: string): Promise<TokenData> {
65-
return this._get<TokenData>(`token`, { code, verifier });
64+
async getToken(code: string, verifier: string): Promise<TokenData> {
65+
const tokenData = await this._get<TokenData>(`token`, { code, verifier });
66+
// n.b. Versions before v6 did not return the provider_id_token or identity_id
67+
return {
68+
...tokenData,
69+
identity_id: tokenData.identity_id ?? null,
70+
provider_id_token: tokenData.provider_id_token ?? null,
71+
};
6672
}
6773

6874
getWebAuthnSignupOptionsUrl(email: string) {

packages/auth-core/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export interface TokenData {
7575
identity_id: string | null;
7676
provider_token: string | null;
7777
provider_refresh_token: string | null;
78+
provider_id_token: string | null;
7879
}
7980

8081
export type RegistrationResponse =

0 commit comments

Comments
 (0)