worried-journalist-71921
07/08/2024, 11:16 AMchilly-king-10285
07/08/2024, 11:16 AMchilly-king-10285
07/08/2024, 11:17 AM/projects
endpoint. The request body should include the details of the project to be created. Here is an example of the request body: json { 'content': { 'application/json': { 'schema': { 'description': 'Create Project Request Body', 'properties': { 'environment': { 'description': 'The environment of the project.\nprod Production\nstage Staging\ndev Development', 'enum': ['prod', 'stage', 'dev'], 'type': 'string', 'x-go-enum-desc': 'prod Production\nstage Staging\ndev Development' }, 'home_region': { 'description': 'Home Region\n\nThe home region of the project. This is the region where the project will be created.\neu-central EUCentral\nus-east USEast\nus-west USWest\nglobal Global', 'enum': ['eu-central', 'us-east', 'us-west', 'global'], 'type': 'string', 'x-go-enum-desc': 'eu-central EUCentral\nus-east USEast\nus-west USWest\nglobal Global' }, 'name': { 'description': 'The name of the project to be created', 'type': 'string' }, 'workspace_id': { 'description': 'The workspace to create the project in.', 'format': 'uuid', 'type': 'string' } }, 'required': ['name', 'environment'], 'type': 'object' } } }, 'x-originalParamName': 'Body' }
The environment
and name
fields are required. The environment
field can be one of prod
, stage
, or dev
. The home_region
field can be one of eu-central
, us-east
, us-west
, or global
. To perform this operation, you must be authenticated by means of the oryWorkspaceApiKey
method. For more details, please refer to the [Ory API Reference](https://www.ory.sh/docs/reference/api). Please note that the actual Go code to make this API request is not provided in the knowledge sources. You would typically use an HTTP client library in Go to make this request.worried-journalist-71921
07/08/2024, 1:28 PMchilly-king-10285
07/08/2024, 1:28 PMchilly-king-10285
07/08/2024, 1:29 PMjavascript // Set up the endpoint and refresh token const endpoint = "<https://oauth2.example.com/token>" const refreshToken = "<refresh token>" const clientId = "<client id>" const clientSecret = "<client secret>" const params = new URLSearchParams({ grant_type: "refresh_token", refresh_token: refreshToken, scope: "scope1 scope2", client_id: clientId, client_secret: clientSecret, }) // Send a POST request to refresh the access token fetch(endpoint, { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded", }, body: params.toString(), }) .then((response) => { if (!response.ok) { throw new Error("Failed to refresh access token") } return response.json() }) .then((data) => { console.log("New access token:", data.access_token) console.log("New ID token:", data.id_token) console.log("New refresh token:", data.refresh_token) }) .catch((error) => { console.error(error) })
When a client uses a refresh token to obtain a new access token, the authorization server may also issue a new ID token if the original token exchange included an ID token. The new ID token has an updated expiry time but retains the same auth_time
(time when the user authenticated). The auth_time
claim in the ID token is used to determine if the user's authentication session is still active. For more details, please refer to the [Ory OAuth2 refresh token grant documentation](https://www.ory.sh/docs/oauth2-oidc/refresh-token-grant#refreshing-an-access-token).