Migrate a session from an external OIDC compliant endpoint. Stytch will call the external UserInfo endpoint defined in your Stytch Project settings in the Dashboard, and then perform a lookup using the session_token. If the response contains a valid email address, Stytch will attempt to match that email address with an existing User and create a Stytch Session. You will need to create the user before using this endpoint.
Migrate Session
POSThttps://test.stytch.com/v1/sessions/migrate
Body parameters
session_token* string
session_duration_minutes int
session_custom_claims map<string, any>
Response fields
request_id string
user_id string
session object
session_token string
session_jwt string
user object
curl --request POST \
--url https://test.stytch.com/v1/sessions/migrate \
-u 'PROJECT_ID:SECRET' \
-H 'Content-Type: application/json' \
-d '{
"session_token": "mZAYn5aLEqKUlZ_Ad9U_fWr38GaAQ1oFAhT8ds245v7Q"
}'
RESPONSE
200
{
"status_code": 200,
"request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
"user_id": "user-test-16d9ba61-97a1-4ba4-9720-b03761dc50c6",
"session_token": "mZAYn5aLEqKUlZ_Ad9U_fWr38GaAQ1oFAhT8ds245v7Q",
"session_jwt": "eyJ...",
"user": "{...}",
"session": "{...}"
}