Skip to content

Commit 13993f5

Browse files
authored
Merge pull request #5 from ericmand/master
Add idToken to access token claims
2 parents d5e3182 + c54bffe commit 13993f5

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/components/Auth0Context.svelte

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
isAuthenticated,
1010
isLoading,
1111
authError,
12-
userInfo
12+
userInfo,
13+
idToken
1314
} from './auth0';
1415
1516
// props.
@@ -70,6 +71,9 @@
7071
// fetch the user info
7172
const user = await auth0.getUser();
7273
userInfo.set(user);
74+
// fetch the token claims
75+
const idTokenClaims = await auth0.getIdTokenClaims();
76+
idToken.set(idTokenClaims.__raw);
7377
// automatically keep a curent token.
7478
refreshToken();
7579
tokenRefreshIntervalId = setInterval(refreshToken, refreshRate);

src/components/auth0.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { getContext } from 'svelte';
77
export const isLoading = writable(true);
88
export const isAuthenticated = writable(false);
99
export const authToken = writable('');
10+
export const idToken = writable('');
1011
export const userInfo = writable({});
1112
export const authError = writable(null);
1213

0 commit comments

Comments
 (0)