Skip to content

(Question) Update customer through JWT tokens #605

@mohdfaiezuan-wq

Description

@mohdfaiezuan-wq

Expected behavior

When we call Intercom.instance.setUserJwt(newJwtToken) with a new JWT (e.g. after token refresh or re-login), we expect Intercom to update the logged-in user's JWT-protected attributes (e.g. name, email from the JWT payload) so that the Intercom profile stays in sync with the new token.

Actual behavior

After calling only setUserJwt(newJwtToken):

  • The new JWT is accepted (e.g. identity verification works with the new token).
  • User attributes that are protected by JWT (name, email, etc.) are not updated on the Intercom side; they retain the previous values.

To get the profile to match the new JWT we have to:

  1. Call Intercom.instance.updateUser(name: ..., email: ...) with those values.

So "updating the JWT" alone is not enough to refresh JWT-protected attributes; an explicit updateUser() call is required.

Steps to reproduce

  1. Log in a user and set an initial JWT: Intercom.instance.setUserJwt(initialToken) with initial name
  2. Obtain a new JWT (e.g. refresh or new login) whose payload has updated name (or other JWT-protected attributes).
  3. Call only Intercom.instance.setUserJwt(newToken) — do not call updateUser().
  4. Check the user in Intercom (e.g. via dashboard or fetchLoggedInUserAttributes()).

Result: JWT is updated but name still show the old values.

Workaround

After each setUserJwt(newToken), decode the JWT payload and call Intercom.instance.updateUser(...) with the desired attributes (e.g. name) so the profile matches the new token.

Question

Is it intended that setUserJwt() only updates the token and does not trigger a sync of JWT-protected user attributes?

Environment

  • Package: intercom_flutter (9.4.22)
  • Platform: iOS / Android (or both)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions