Skip to content

Commit 7c2174a

Browse files
authored
Allow for bypass of user fetching during auth (#208)
1 parent 16c9a50 commit 7c2174a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/data-sdk/src/stores/AuthenticationStore.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,11 @@ export class AuthenticationStore implements IAuthenticationStore {
161161
}
162162
}
163163

164-
async loginWithToken(token: string, refreshToken?: string) {
164+
async loginWithToken(
165+
token: string,
166+
refreshToken?: string,
167+
skipUserFetch = false
168+
) {
165169
const tokenData = JSON.parse(decode(token.split(".")[1]));
166170
try {
167171
let userId: string | undefined;
@@ -183,7 +187,7 @@ export class AuthenticationStore implements IAuthenticationStore {
183187
userId = tokenData["formant:claims"].userId;
184188
}
185189

186-
if (userId && this._currentUser?.id !== userId) {
190+
if (userId && this._currentUser?.id !== userId && !skipUserFetch) {
187191
const result = await fetch(`${this._apiUrl}/v1/admin/users/${userId}`, {
188192
method: "GET",
189193
headers: {

0 commit comments

Comments
 (0)