Crée un cookie de session pour le jeton d'ID Identity Platform donné. Le client utilise le cookie de session pour conserver l'état de connexion de l'utilisateur.
Requête HTTP
POST https://identitytoolkit.googleapis.com/v1/projects/{targetProjectId}/tenants/{tenantId}:createSessionCookie
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/03/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 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)."]]