Crea una cookie de sesión para el token de ID de Identity Platform determinado. El cliente usa la cookie de sesión para preservar el estado de acceso del usuario.
Solicitud HTTP
POST https://identitytoolkit.googleapis.com/v1/projects/{targetProjectId}/tenants/{tenantId}:createSessionCookie
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-03-04 (UTC)"],[[["\u003cp\u003eThis webpage details the process of creating a session cookie using the Identity Platform ID token, which is done through an HTTP POST request to a specified URL.\u003c/p\u003e\n"],["\u003cp\u003eThe request requires two path parameters: \u003ccode\u003etargetProjectId\u003c/code\u003e representing the project ID, and \u003ccode\u003etenantId\u003c/code\u003e representing the tenant ID that the account belongs to.\u003c/p\u003e\n"],["\u003cp\u003eThe request body must be in JSON format and contain both an \u003ccode\u003eidToken\u003c/code\u003e, which is a valid Identity Platform ID token, and a \u003ccode\u003evalidDuration\u003c/code\u003e, which is an integer value specifying the cookie's expiration time in seconds, that is between five minutes and fourteen days.\u003c/p\u003e\n"],["\u003cp\u003eSuccessful requests will receive a response body containing an instance of \u003ccode\u003eCreateSessionCookieResponse\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eTo perform the operation, the request must be authorized using one of two OAuth scopes: \u003ccode\u003ehttps://www.googleapis.com/auth/identitytoolkit\u003c/code\u003e or \u003ccode\u003ehttps://www.googleapis.com/auth/cloud-platform\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Method: projects.tenants.createSessionCookie\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nCreates 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.\n\n### HTTP request\n\n`POST https://identitytoolkit.googleapis.com/v1/projects/{targetProjectId}/tenants/{tenantId}:createSessionCookie`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n### Request body\n\nThe request body contains data with the following structure:\n\n### Response body\n\nIf successful, the response body contains an instance of [CreateSessionCookieResponse](/identity-platform/docs/reference/rest/v1/CreateSessionCookieResponse).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/identitytoolkit`\n- `\n https://www.googleapis.com/auth/cloud-platform`\n\nFor more information, see the [Authentication Overview](/docs/authentication#authorization-gcp)."]]