Commit e84085b 1 parent cfd9537 commit e84085b Copy full SHA for e84085b
File tree 2 files changed +6
-3
lines changed
2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -8,11 +8,12 @@ import { getClaims } from "./getClaims";
8
8
*/
9
9
export const getClaim = async < T = JWTDecoded , V = string | number | string [ ] > (
10
10
keyName : keyof T ,
11
+ tokenType : "accessToken" | "idToken" = "accessToken" ,
11
12
) : Promise < {
12
13
name : keyof T ;
13
14
value : V ;
14
15
} | null > => {
15
- const claims = await getClaims < T > ( ) ;
16
+ const claims = await getClaims < T > ( tokenType ) ;
16
17
if ( ! claims ) {
17
18
return null ;
18
19
}
Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ import { getDecodedToken } from "./getDecodedToken";
5
5
* get all claims from the token
6
6
* @returns { Promise<T | null> }
7
7
*/
8
- export const getClaims = async < T = JWTDecoded > ( ) : Promise < T | null > => {
9
- return getDecodedToken < T > ( "accessToken" ) ;
8
+ export const getClaims = async < T = JWTDecoded > (
9
+ tokenType : "accessToken" | "idToken" = "accessToken" ,
10
+ ) : Promise < T | null > => {
11
+ return getDecodedToken < T > ( tokenType ) ;
10
12
} ;
You can’t perform that action at this time.
0 commit comments