Skip to content

Enable self-service profile updates in Android SDKs - #26

Merged
brionmario merged 1 commit into
thunder-id:mainfrom
janithjay:users-me-profile
Aug 28, 2026
Merged

Enable self-service profile updates in Android SDKs#26
brionmario merged 1 commit into
thunder-id:mainfrom
janithjay:users-me-profile

Conversation

@janithjay

@janithjay janithjay commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Purpose

Currently, the Android SDK's user profile view sources attributes from the JWT/userinfo claims embedded in the sign-in token, which is read-only and limited to whatever claims a given application's token happens to carry.

This PR makes the profile view fetch from GET /users/me by default, matching the JavaScript SDK, and adds,

  • Self-service editing per attribute, validated and saved against the schema from GET /users/me/meta (PUT /users/me).
  • Avatar picture and display-name sync from the real profile, kept in sync with ThunderIDState.user across sign-in/refresh.
  • An opt-out config flag, ThunderIDConfig.fetchUserProfile (default true), for apps that want the previous token-claims-only, read-only behavior instead.

Approach

  • ThunderIDClient: fixed getUserProfile()/added getUserSchema() to call the real /users/me / /users/me/meta endpoints (previously pointed at nonexistent /scim2/* routes). updateUserProfile() now does PUT /users/me with {"attributes": {...}}, matching the backend's actual contract.
  • UserProfile.kt: schema-driven field building (buildProfileFields), validation (validateField: required + regex, invalid regex ignored rather than blocking save), and a merge-before-save step (deepMergeAttributes) since the backend rejects a save missing any required attribute, even for a single-field edit.
  • Token-only mode (fetchUserProfile = false) intentionally mirrors the Quickstart's pre-existing userAttributes() / formatClaim() / claimLabel() behavior verbatim rather than reinventing it, now hoisted from the sample into the reusable SDK component.
  • ThunderIDState: the /users/me profile-picture sync is launched on the ThunderIDProvider level CoroutineScope rather than awaited inline, since it's triggered from screens (e.g. SignIn) that unmount and cancel their own rememberCoroutineScope() right as the user signs in.
  • New vector drawables (ic_edit, ic_check, ic_close) hand-drawn to match the existing icon convention.

After fix default method (fetchUserProfile = true)

image

After fix attributes fetch from sign-in token method (fetchUserProfile = false)

image

Related Issues

Related PRs

Checklist

  • Followed the contribution guidelines.
  • Manual test round performed and verified.
  • Documentation provided. (Add links if there are any)
  • Tests provided. (Add links if there are any)
    • Unit Tests
    • Integration Tests
  • Breaking changes. (Fill if applicable)
    • Breaking changes section filled.
    • breaking change label added.

Security checks

  • Followed secure coding standards.
  • Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.

Copilot AI lite review requested due to automatic review settings August 24, 2026 10:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8649d4f1-8c03-4c0a-9bcc-7cf00144a14f


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Signed-off-by: janithjay <janithjayashan018@gmail.com>
@brionmario
brionmario merged commit 337fcbb into thunder-id:main Aug 28, 2026
8 checks passed
@janithjay
janithjay deleted the users-me-profile branch August 28, 2026 06:23
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.

3 participants