Skip to content

Commit 9d8926a

Browse files
committed
Safer check
1 parent a16f24d commit 9d8926a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/cloud/src/WebAuthService.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,9 +707,14 @@ export class WebAuthService extends EventEmitter<AuthServiceEvents> implements A
707707
}
708708

709709
private async clerkGetOrganizationMemberships(): Promise<CloudOrganizationMembership[]> {
710+
if (!this.credentials) {
711+
this.log("[auth] Cannot get organization memberships: missing credentials")
712+
return []
713+
}
714+
710715
const response = await fetch(`${getClerkBaseUrl()}/v1/me/organization_memberships`, {
711716
headers: {
712-
Authorization: `Bearer ${this.credentials!.clientToken}`,
717+
Authorization: `Bearer ${this.credentials.clientToken}`,
713718
"User-Agent": this.userAgent(),
714719
},
715720
signal: AbortSignal.timeout(10000),

0 commit comments

Comments
 (0)