You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -125,14 +125,129 @@ See the example below or explore our [detailed example](https://github.com/Genym
125
125
126
126
// Disconnect the device renderer, closing any open data channels.
127
127
window.addEventListener('beforeunload', function () {
128
-
playerAPI.disconnect();
128
+
rendererAPI.VM_communication.disconnect();
129
129
});
130
130
</script>
131
131
```
132
132
133
133
### 🔑 A word about the token
134
134
135
-
To connect a [SaaS](https://docs.genymotion.com/saas/) instance you need to generate and use a specific token. This must be done by using our [endpoint API](https://developer.genymotion.com/saas/#tag/Instances-v1/operation/accessToken). When using this API, don't forget to include the x-api-token HTTP header with a valid [Bearer](https://developer.genymotion.com/saas/#tag/Users-v1/operation/login) or [API Token](https://www.genymotion.com/blog/api-tokens-for-genymotion-saas/)
135
+
For SaaS, the player requires an instance-scoped access token (`access_token`) — not a user JWT. Use exactly one authentication scheme per SaaS API request:
136
+
137
+
-`Authorization: Bearer <JWT>` after logging in via `POST /v1/users/login`, or
138
+
-`x-api-token: <API_TOKEN>` using an API token from the SaaS portal.
- API token: skip login and use `x-api-token` directly.
147
+
2. Get your instance info (for `webrtcAddress`): `GET /v1/instances/<INSTANCE_UUID>` using your chosen header.
148
+
3. Generate the per-instance access token: `POST /v1/instances/access-token` with body `{"instance_uuid":"<INSTANCE_UUID>"}` using the same header.
149
+
4. Use the returned `access_token` as `options.token` when calling `setupRenderer`.
150
+
151
+
Notes:
152
+
- SaaS JWTs expire (e.g., ~48h). Regenerate by re-login when needed.
153
+
- The `access_token` is scoped to a single instance and may expire; if you receive a token invalid/expired error, call the access-token endpoint again and reconnect.
154
+
- For PaaS, `options.token` is the instance ID provided by your device provider. No SaaS API calls are required.
If the player fails to connect, check for these common WebSocket close codes:
247
+
-**4242**: The token is invalid or incorrect. Verify you are using the `access_token` for SaaS, not a JWT.
248
+
-**4243**: The token has expired. Regenerate a new `access_token` using the `/v1/instances/access-token` endpoint and reconnect.
249
+
- If you get HTTP 400/401 errors from the SaaS API, ensure you are using exactly one authentication header (`Authorization` or `x-api-token`), not both.
250
+
136
251
137
252
## 🎨 Style and CSS
138
253
@@ -320,7 +435,7 @@ A device renderer instance can be configured using the `options` argument (objec
320
435
-**Default:**`undefined`
321
436
-**Compatibility:**`PaaS`, `SaaS`
322
437
-**Details:**
323
-
Instance access token, the shared secret used to connect to the device. For Genymotion PaaS devices, the token is the instance id (more information can be find [here](https://docs.genymotion.com/paas/02_Getting_Started/)). For SaaS devices, you must generate the access token using the [login api](https://developer.genymotion.com/saas/#operation/login).
438
+
Instance access token, the shared secret used to connect to the device. For Genymotion PaaS devices, the token is the instance id (more information can be find [here](https://docs.genymotion.com/paas/02_Getting_Started/)). For SaaS devices, you must generate the access token using the [`/v1/instances/access-token` endpoint](https://developer.genymotion.com/saas/#tag/Instances-v1/operation/accessToken).
0 commit comments