Skip to content

Commit

Permalink
Update the example to provide the instance uuid when fetching a JWT t…
Browse files Browse the repository at this point in the history
…oken.

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.
  • Loading branch information
caarmen committed Sep 26, 2024
1 parent 3c696e1 commit 9514356
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions example/geny-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -95,7 +98,7 @@ const startInstance = async (recipeUuid) => {

instanceUuid = recipe.uuid;

await getJWTToken();
await getJWTToken(instanceUuid);

return recipe;
};
Expand Down Expand Up @@ -202,7 +205,7 @@ const connectInstance = async (wsAddress) => {
});
const instance = await response.json();
instanceUuid = instance.uuid;
await getJWTToken();
await getJWTToken(instanceUuid);
initPlayer(instance.publicWebrtcUrl);
};

Expand Down

0 comments on commit 9514356

Please sign in to comment.