Skip to content

[auth] Add id_token field to UberToken and validate nonce claim#274

Draft
partha-uber wants to merge 2 commits into
sirker-auth-nonce-autogenfrom
sirker-auth-nonce-idtoken
Draft

[auth] Add id_token field to UberToken and validate nonce claim#274
partha-uber wants to merge 2 commits into
sirker-auth-nonce-autogenfrom
sirker-auth-nonce-idtoken

Conversation

@partha-uber

@partha-uber partha-uber commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • UberToken gains @Json(name = "id_token") val idToken: String? for
    OIDC id_token deserialization
  • AuthException.NONCE_MISMATCH constant added for replay-attack detection
  • performPkce validates the nonce claim in id_token against
    effectiveNonce; returns NONCE_MISMATCH error on mismatch
  • extractNonceFromIdToken decodes the JWT payload (base64url) and
    extracts the nonce claim via org.json.JSONObject — no extra libs
  • Validation is skipped when server returns no id_token (backward compat)

This is step 3/3 of iOS parity (PR #337 in uber-ios-sdk).

Test Plan

Issues

Stack

  1. [auth] Add state (CSRF) parameter to OAuth flow #272
  2. [auth] Auto-generate nonce when caller does not provide one #273
  3. @ [auth] Add id_token field to UberToken and validate nonce claim #274

Summary:
- `UberToken` gains `@Json(name = "id_token") val idToken: String?` for
  OIDC id_token deserialization
- `AuthException.NONCE_MISMATCH` constant added for replay-attack detection
- `performPkce` validates the `nonce` claim in `id_token` against
  `effectiveNonce`; returns `NONCE_MISMATCH` error on mismatch
- `extractNonceFromIdToken` decodes the JWT payload (base64url) and
  extracts the `nonce` claim via `org.json.JSONObject` — no extra libs
- Validation is skipped when server returns no `id_token` (backward compat)

This is step 3/3 of iOS parity (PR #337 in uber-ios-sdk).
@partha-uber partha-uber force-pushed the sirker-auth-nonce-idtoken branch from 0685a42 to 17d60b3 Compare June 18, 2026 02:59
@partha-uber partha-uber requested a review from lalwani June 18, 2026 03:07
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.

1 participant