Skip to content

Commit abc2911

Browse files
authored
Update OAuth userinfo typing (#599)
Keep sync typing with moon
1 parent c5ca64b commit abc2911

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

packages/hub/src/lib/oauth-handle-redirect.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,14 @@ export interface OAuthResult {
1313
avatarUrl: string;
1414
websiteUrl?: string;
1515
isPro: boolean;
16+
canPay?: boolean;
1617
orgs: Array<{
18+
id: string;
1719
name: string;
1820
isEnterprise: boolean;
21+
canPay?: boolean;
22+
avatarUrl: string;
23+
roleInOrg?: string;
1924
}>;
2025
};
2126
/**
@@ -151,9 +156,14 @@ export async function oauthHandleRedirect(opts?: { hubUrl?: string }): Promise<O
151156
picture: string;
152157
website?: string;
153158
isPro: boolean;
159+
canPay?: boolean;
154160
orgs?: Array<{
161+
sub: string;
155162
name: string;
163+
picture: string;
156164
isEnterprise: boolean;
165+
canPay?: boolean;
166+
roleInOrg?: string;
157167
}>;
158168
} = await userInfoRes.json();
159169

@@ -169,7 +179,16 @@ export async function oauthHandleRedirect(opts?: { hubUrl?: string }): Promise<O
169179
avatarUrl: userInfo.picture,
170180
websiteUrl: userInfo.website,
171181
isPro: userInfo.isPro,
172-
orgs: userInfo.orgs || [],
182+
orgs:
183+
userInfo.orgs?.map((org) => ({
184+
id: org.sub,
185+
name: org.name,
186+
fullname: org.name,
187+
isEnterprise: org.isEnterprise,
188+
canPay: org.canPay,
189+
avatarUrl: org.picture,
190+
roleInOrg: org.roleInOrg,
191+
})) ?? [],
173192
},
174193
state: parsedState.state,
175194
scope: token.scope,

0 commit comments

Comments
 (0)