diff --git a/backend/internal/pkg/oauth/oauth.go b/backend/internal/pkg/oauth/oauth.go index 0a607dfb..66c84445 100644 --- a/backend/internal/pkg/oauth/oauth.go +++ b/backend/internal/pkg/oauth/oauth.go @@ -215,5 +215,6 @@ type OrgInfo struct { // AccountInfo represents account info from OAuth response type AccountInfo struct { - UUID string `json:"uuid"` + UUID string `json:"uuid"` + EmailAddress string `json:"email_address"` } diff --git a/backend/internal/service/oauth_service.go b/backend/internal/service/oauth_service.go index 03c3438a..15543080 100644 --- a/backend/internal/service/oauth_service.go +++ b/backend/internal/service/oauth_service.go @@ -122,6 +122,7 @@ type TokenInfo struct { Scope string `json:"scope,omitempty"` OrgUUID string `json:"org_uuid,omitempty"` AccountUUID string `json:"account_uuid,omitempty"` + EmailAddress string `json:"email_address,omitempty"` } // ExchangeCode exchanges authorization code for tokens @@ -252,9 +253,15 @@ func (s *OAuthService) exchangeCodeForToken(ctx context.Context, code, codeVerif tokenInfo.OrgUUID = tokenResp.Organization.UUID log.Printf("[OAuth] Got org_uuid: %s", tokenInfo.OrgUUID) } - if tokenResp.Account != nil && tokenResp.Account.UUID != "" { - tokenInfo.AccountUUID = tokenResp.Account.UUID - log.Printf("[OAuth] Got account_uuid: %s", tokenInfo.AccountUUID) + if tokenResp.Account != nil { + if tokenResp.Account.UUID != "" { + tokenInfo.AccountUUID = tokenResp.Account.UUID + log.Printf("[OAuth] Got account_uuid: %s", tokenInfo.AccountUUID) + } + if tokenResp.Account.EmailAddress != "" { + tokenInfo.EmailAddress = tokenResp.Account.EmailAddress + log.Printf("[OAuth] Got email_address: %s", tokenInfo.EmailAddress) + } } return tokenInfo, nil diff --git a/frontend/src/composables/useAccountOAuth.ts b/frontend/src/composables/useAccountOAuth.ts index e0f77590..bdc6f0f1 100644 --- a/frontend/src/composables/useAccountOAuth.ts +++ b/frontend/src/composables/useAccountOAuth.ts @@ -17,6 +17,7 @@ export interface OAuthState { export interface TokenInfo { org_uuid?: string account_uuid?: string + email_address?: string [key: string]: unknown } @@ -160,6 +161,9 @@ export function useAccountOAuth() { if (tokenInfo.account_uuid) { extra.account_uuid = tokenInfo.account_uuid } + if (tokenInfo.email_address) { + extra.email_address = tokenInfo.email_address + } return Object.keys(extra).length > 0 ? extra : undefined } diff --git a/frontend/src/views/admin/AccountsView.vue b/frontend/src/views/admin/AccountsView.vue index 3b246c5b..222f248d 100644 --- a/frontend/src/views/admin/AccountsView.vue +++ b/frontend/src/views/admin/AccountsView.vue @@ -113,8 +113,17 @@ -