-
-
Notifications
You must be signed in to change notification settings - Fork 0
release(v2.24.0): DOS.Me JIT teams claims, auth sync & ecosystem stability #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -40,7 +40,7 @@ export class OauthProvider extends AuthProviderAbstract { | |||||
| const { authUrl, clientId, frontendUrl } = this.getConfig(); | ||||||
| const params = new URLSearchParams({ | ||||||
| client_id: clientId, | ||||||
| scope: process.env.POSTIZ_OAUTH_SCOPE || 'openid profile email organizations offline_access', | ||||||
| scope: process.env.POSTIZ_OAUTH_SCOPE || 'openid profile email organizations teams offline_access', | ||||||
| response_type: 'code', | ||||||
| state: query?.state || 'login', | ||||||
| redirect_uri: `${frontendUrl}/auth`, | ||||||
|
|
@@ -80,7 +80,9 @@ export class OauthProvider extends AuthProviderAbstract { | |||||
| id: string; | ||||||
| name?: string; | ||||||
| picture?: string; | ||||||
| organizations?: Array<{ id: string; name: string; role?: 'OWNER' | 'ADMIN' | 'MEMBER' }>; | ||||||
| active_org_id?: string; | ||||||
| organizations?: Array<{ id: string; name: string; slug?: string; role?: 'OWNER' | 'ADMIN' | 'MEMBER' | 'SUPERADMIN' }>; | ||||||
| teams?: Array<{ id: string; org_id: string; name: string; slug: string; role?: 'LEAD' | 'MEMBER' | string }>; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In TypeScript, unioning specific string literal types (like 'LEAD' | 'MEMBER') with the generic string type causes the entire union to collapse into string. This defeats type safety and autocompletion for the specific roles. To preserve IDE autocompletion for 'LEAD' and 'MEMBER' while still allowing any custom string, use the (string & {}) idiom.
Suggested change
|
||||||
| }> { | ||||||
| const { userInfoUrl } = this.getConfig(); | ||||||
| const response = await fetch(`${userInfoUrl}`, { | ||||||
|
|
@@ -101,7 +103,9 @@ export class OauthProvider extends AuthProviderAbstract { | |||||
| id: payload.sub || payload.id, | ||||||
| name: payload.name || payload.full_name || payload.user_metadata?.name || payload.user_metadata?.full_name, | ||||||
| picture: payload.picture || payload.avatar_url || payload.user_metadata?.picture || payload.user_metadata?.avatar_url, | ||||||
| active_org_id: payload.active_org_id || payload.user_metadata?.active_org_id, | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To prevent potential runtime TypeError exceptions if payload or payload.user_metadata is null or undefined, use optional chaining (payload?.active_org_id and payload?.user_metadata?.active_org_id).
Suggested change
|
||||||
| organizations: payload.organizations || payload.user_metadata?.organizations || [], | ||||||
| teams: payload.teams || payload.user_metadata?.teams || [], | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To prevent potential runtime TypeError exceptions if payload or payload.user_metadata is null or undefined, use optional chaining (payload?.teams and payload?.user_metadata?.teams).
Suggested change
|
||||||
| }; | ||||||
| } | ||||||
| } | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In TypeScript, unioning specific string literal types (like 'LEAD' | 'MEMBER') with the generic string type causes the entire union to collapse into string. This defeats type safety and autocompletion for the specific roles. To preserve IDE autocompletion for 'LEAD' and 'MEMBER' while still allowing any custom string, use the (string & {}) idiom.