Verify session
Verify a Session
POST
/appid-{appId}/recipe/session/verifyAuthorization
api-keyAPI key · headerrequiredThe core service API token. If you are using a self-hosted core service and you have not generated a token, you can omit the header.
Header parameters
ridstringcdi-versionstringX.Y of the X.Y.Z CDI version.
Request body
application/jsonaccessTokentokenenableAntiCsrfenableAntiCsrfdoAntiCsrfCheckbooleancheckDatabasebooleanDecides if we always check if the session exists in the DB or just do token validation, defaults to false.
antiCsrfTokentokenResponses
200Verify a session
One of:
object
statusstatusOKAllowed:
OKsessionsessionShow propertiesHide properties
handlehandleuserIduserIduserDataInJWTuserDataInJWTshould be a JSON object (not a JSON literal nor an array)
tenantIdtenantIdrecipeUserIduserIdaccessTokencookieInfoShow propertiesHide properties
tokentokenexpiryexpirycreatedTimetimeCreatedunauthorisedMessageResponse
statusunauthorisedResponseAllowed:
UNAUTHORISEDmessagemessageobject
statustryRefreshTokenResponseAllowed:
TRY_REFRESH_TOKENmessagemessage400error code 400
string401error code 401
string404error code 404
string500error code 500
stringTry it
Server
Authorization
Parameters
Bodyapplication/json
Request
curl -X POST "/appid-{appId}/recipe/session/verify" \
-H "api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"accessToken": "ZTRiOTBjNz...jI5MTZlODkxw",
"enableAntiCsrf": false,
"doAntiCsrfCheck": false,
"checkDatabase": false,
"antiCsrfToken": "ZTRiOTBjNz...jI5MTZlODkxw"
}'const response = await fetch("/appid-{appId}/recipe/session/verify", {
method: "POST",
headers: {
"api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
"accessToken": "ZTRiOTBjNz...jI5MTZlODkxw",
"enableAntiCsrf": false,
"doAntiCsrfCheck": false,
"checkDatabase": false,
"antiCsrfToken": "ZTRiOTBjNz...jI5MTZlODkxw"
})
});import requests
response = requests.post(
"/appid-{appId}/recipe/session/verify",
headers={
"api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
json={
"accessToken": "ZTRiOTBjNz...jI5MTZlODkxw",
"enableAntiCsrf": False,
"doAntiCsrfCheck": False,
"checkDatabase": False,
"antiCsrfToken": "ZTRiOTBjNz...jI5MTZlODkxw"
},
)Response
{
"status": "OK",
"session": {
"handle": "68en6gd6-865b-4af6-ba00-96e5c153257d",
"userId": "fa7a0841-b533-4478-95533-0fde890c3483",
"userDataInJWT": {
"test": 123
},
"tenantId": "customer1",
"recipeUserId": "fa7a0841-b533-4478-95533-0fde890c3483"
},
"accessToken": {
"token": "ZTRiOTBjNz...jI5MTZlODkxw",
"expiry": 1637262633029,
"createdTime": 1637262633029
}
}"string""Invalid API key""Not Found""Internal Error"