How It Works
Your backend signs a JWT
After your own auth system verifies the user, your server signs a JWT using
your Replyke project’s RSA private key. The token identifies the user by
their ID in your system.
The SDK exchanges the JWT
Call
verifyExternalUser (available via the useAuth hook or directly) with
the signed JWT. Replyke verifies the signature, looks up or creates the user,
and returns Replyke access and refresh tokens.JWT Requirements
Your backend must sign the JWT using RS256 (RSA 256-bit) with your project’s private key. The payload must include:| Claim | Description |
|---|---|
sub | The user’s ID in your system (becomes foreignId in Replyke) |
iss | Your Replyke project ID |
userData | Object with optional profile fields (see below) |
userData fields
All fields in userData are optional. If a user already exists and any field has changed, Replyke updates the stored value.
| Field | Type | Description |
|---|---|---|
email | string | User’s email address |
name | string | Display name |
username | string | Unique username within the project |
avatar | string | URL of avatar image |
bio | string | Short bio text |
location | object | { latitude, longitude } |
birthdate | string | ISO 8601 date string |
metadata | object | Public custom data |
secureMetadata | object | Private custom data |
Backend Example (Node.js)
Frontend Integration
Pass the signed JWT directly toReplykeProvider (or ReplykeIntegrationProvider if you manage your own Redux store) via the signedToken prop. The SDK exchanges the token automatically on initialization — no manual API calls required.
signedToken changes (e.g., after a new user signs in), the SDK re-initializes auth with the updated token automatically.
User Identity
When a user signs in via external auth, Replyke stores thesub claim as foreignId on the user record and creates a UserIdentity entry with provider: "external". On subsequent sign-ins, the user is looked up by identity first, then by foreignId as a fallback, then by email.

