Skip to content

feat(identify): send user data to identify after oauth flow - #228

Merged
LorrisSaintGenez merged 3 commits into
mainfrom
feat/track-authenticated-user
Jun 3, 2026
Merged

LorrisSaintGenez merged 3 commits into
mainfrom
feat/track-authenticated-user

Conversation

@LorrisSaintGenez

@LorrisSaintGenez LorrisSaintGenez commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

What

Persist the authenticated user's identity alongside the OAuth tokens so CLI telemetry can attribute events to the logged-in user.

  • Store identity in the token. StoredToken now carries user_id/email/name, populated by SaveToken from the OAuth response's user object (same keychain entry — identity is bound to the token, not a profile).
  • Expose via LoadToken. Any caller reads identity straight off the stored token.
  • Send to Segment. root.go populates CLIAnalyticsEventMetadata from the stored token before Identify/Track. When authenticated, both carry userId (alongside anonymousId, so the first event aliases anonymous→user); email/name go on Identify traits.
  • Self-heals on refresh. GetValidToken back-fills identity from the refresh response for sessions created before this change, and preserves stored identity when a refresh response omits the user.

Test

  • Login
go run ./cmd/algolia auth login
  • Check token contains the correct data (token data + user id, email and name)
security find-generic-password -s algolia-cli -a oauth-token -w \
  | sed 's/^go-keyring-base64://' | base64 -d | jq .   # → includes user_id, email, name
  • Check on Segment that you see the Identity call with your user id attached
  • On subsequent commands, your userID should be attached to each command invocation

Preview

Screenshot 2026-06-02 at 11 21 05 Screenshot 2026-06-02 at 11 21 13

GROUT-350

@codacy-production

codacy-production Bot commented Jun 2, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 30 complexity · 14 duplication

Metric Results
Complexity 30
Duplication 14

View in Codacy

TIP This summary will be updated as you push new changes.

@LorrisSaintGenez LorrisSaintGenez changed the title feat(identify): send user data to identify after login feat(identify): send user data to identify after oauth flow Jun 2, 2026
@LorrisSaintGenez
LorrisSaintGenez merged commit bb3ca9b into main Jun 3, 2026
3 checks passed
@LorrisSaintGenez
LorrisSaintGenez deleted the feat/track-authenticated-user branch June 3, 2026 17:33
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
algolia 1.11.0

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>## What's Changed
* feat(open): add new dashboard shortcuts by @LorrisSaintGenez in algolia/cli#225
* feat(application): update/upgrade/downgrade/plans commands by @LorrisSaintGenez in algolia/cli#224
* docs: add npm install option to README by @tkrugg in algolia/cli#223
* feat(application): add name, tos and plan selection during application creation by @LorrisSaintGenez in algolia/cli#227
* feat(identify): send user data to identify after oauth flow by @LorrisSaintGenez in algolia/cli#228
* feat(application): more precise plan upgrade/downgrade direction by @LorrisSaintGenez in algolia/cli#226
* feat(telemetry): CLI flow events by @LorrisSaintGenez in algolia/cli#243
* feat: add auth get command by @levimichael in algolia/cli#253
* chore(api client): Upgrade Algolia Go API client by @tkrugg in algolia/cli#254
* fix: update 'auth get' to support refresh by @levimichael in algolia/cli#255
* feat(auth): Add token to `auth get` command by @levimichael in algolia/cli#257

## New Contributors
* @levimichael made their first contribution in algolia/cli#253

**Full Changelog**: https://github.com/algolia/cli/compare/v1.10.5...v1.11.0</pre>
  <p>View the full release notes at <a href="proxy.php?url=https%3A%2F%2Fgithub.com%2Falgolia%2Fcli%2Fpull%2F%3Ca+href%3D"https://github.com/algolia/cli/releases/tag/v1.11.0">https://github.com/algolia/cli/releases/tag/v1.11.0</a>.</p">https://github.com/algolia/cli/releases/tag/v1.11.0">https://github.com/algolia/cli/releases/tag/v1.11.0</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!13019
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.

2 participants