From 8bce4ea7945baee72be469d26b8e4cc8545ed2c3 Mon Sep 17 00:00:00 2001 From: Carmen Alvarez Date: Thu, 26 Sep 2024 12:27:52 +0200 Subject: [PATCH] Update the example to provide the instance uuid when fetching a JWT token. See the documentation for `POST /v1/instances/access-token`: https://developer.genymotion.com/saas/#tag/Instances-v1/operation/accessToken It has an `instance_uuid` request payload field. --- example/geny-window.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/example/geny-window.js b/example/geny-window.js index 973aa5c..5f47abf 100644 --- a/example/geny-window.js +++ b/example/geny-window.js @@ -29,11 +29,14 @@ const getApiToken = async () => { }; // get jwt token -const getJWTToken = async () => { +const getJWTToken = async (instanceUuid) => { try { const response = await fetch(baseUrlToFetch + `/v1/instances/access-token`, { ...requestInit, method: 'POST', + body: JSON.stringify({ + instance_uuid: instanceUuid, + }), }); if (response.status !== 200) { @@ -95,7 +98,7 @@ const startInstance = async (recipeUuid) => { instanceUuid = recipe.uuid; - await getJWTToken(); + await getJWTToken(instanceUuid); return recipe; }; @@ -202,7 +205,7 @@ const connectInstance = async (wsAddress) => { }); const instance = await response.json(); instanceUuid = instance.uuid; - await getJWTToken(); + await getJWTToken(instanceUuid); initPlayer(instance.publicWebrtcUrl); };