Creates a session cookie for the given Identity Platform ID token. The session cookie is used by the client to preserve the user's login state.
HTTP request
POST https://identitytoolkit.googleapis.com/v1/projects/{targetProjectId}/tenants/{tenantId}:createSessionCookie
The URL uses gRPC Transcoding syntax.
Path parameters
Parameters | |
---|---|
targetProjectId |
The ID of the project that the account belongs to. |
tenantId |
The tenant ID of the Identity Platform tenant the account belongs to. |
Request body
The request body contains data with the following structure:
JSON representation |
---|
{ "idToken": string, "validDuration": string } |
Fields | |
---|---|
idToken |
Required. A valid Identity Platform ID token. |
validDuration |
The number of seconds until the session cookie expires. Specify a duration in seconds, between five minutes and fourteen days, inclusively. |
Response body
If successful, the response body contains an instance of CreateSessionCookieResponse
.
Authorization scopes
Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/identitytoolkit
https://www.googleapis.com/auth/cloud-platform
For more information, see the Authentication Overview.