Skip to content

Add fallback for whoami when People API is disabled#462

Open
cct08311github wants to merge 1 commit intosteipete:mainfrom
cct08311github:codex/people-me-fallback-461
Open

Add fallback for whoami when People API is disabled#462
cct08311github wants to merge 1 commit intosteipete:mainfrom
cct08311github:codex/people-me-fallback-461

Conversation

@cct08311github
Copy link

Summary

  • fall back to token-based profile lookup when people me/whoami hits 403 accessNotConfigured
  • keep the normal People API path when it is enabled
  • add a regression test covering the fallback path

Testing

  • /opt/homebrew/bin/go test ./internal/cmd -run PeopleMe
  • /opt/homebrew/bin/go test ./cmd/gog

Fixes #461

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7752e9617f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +32 to +34
client, err := authclient.ResolveClient(ctx, account)
if err != nil {
return nil, fmt.Errorf("resolve client: %w", err)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve the active auth mode in the People API fallback

If people/me hits accessNotConfigured while the caller is using a supported non-keyring auth path (--access-token, ADC, or service-account impersonation), this helper throws those credentials away and starts a fresh keyring lookup from account. newPeopleContactsService explicitly prefers those context credentials in tokenSourceForAvailableAccountAuth, so gog whoami --access-token ... --account bob@example.com can now report Bob's stored OAuth profile instead of the identity behind the supplied token, or fail with unrelated resolve client/get token errors.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

people me/whoami fails when OAuth client project lacks People API

1 participant