Create a member token
POST/v1/member_tokens
Issues a token for one member. Call it from your server only, after you have checked that the guest is signed in to your app. Identify the member by unPLUG id or by your own external_id, whichever you store.
Permissions: Secret key with member_tokens:create.
Guide
AuthenticationRequest headers#
Idempotency-KeystringAny string up to 255 characters; use a UUID v4. Kept 24 hours per key (or member) and endpoint. Same key and body replays the first response withIdempotent-Replayed: true.Max Length 255
Request body#
member_idstring (uuid)The member's unPLUG id. Send this orexternal_id, not both.external_idstringYour id for the guest, as set when you created the member.
| Field | Description |
|---|---|
tokenstring | Opaque. Don't parse it or rely on its length. |
expires_atstring | 15 minutes after issue. |
member_idstring (uuid) | The member the token acts for. |
Keep the token in memory in the app. If you store it, use the platform's secure storage (Keychain on iOS, EncryptedSharedPreferences on Android). On the web, keep it out of localStorage.
Response fields#
Returns 201 with MemberToken
tokenstringOpaque, starts withmt_.expires_atstring (date-time)member_idstring (uuid)
Error descriptions#
400Bad request
invalid_request
Both or neither of member_id and external_id were sent.
404Not found
member_not_found
No member with that id or external_id. Create the member first with POST /v1/members.
410Gone
member_deleted
The member asked to delete their account. Sign the guest out.
Any endpoint can also return the common errors.