Abstract
The GC LAC Starter Genesys Cloud Load, Auth, Cache is a lightweight, browser-only base for rapid
Genesys Cloud Platform API prototyping. It removes authentication friction so you can start building POCs immediately.
LAC performs three jobs in order: it loads the Genesys Cloud JavaScript SDK, it performs OAuth 2.0 Implicit Grant authentication, and it caches the token for reuse.
No Node, no frameworks, no secrets in the browser.
How does it work?
The starter uses standard web pieces with the official SDK and OAuth flow:
Component | Role | Reference |
---|---|---|
Genesys Cloud JavaScript SDK | Provides ApiClient and typed APIs such as UsersApi , AnalyticsApi |
SDK Docs |
OAuth 2.0 Implicit Grant | Browser-oriented flow, returns an access token via URL fragment after login | Implicit Grant Guide |
Web Storage, localStorage | Persists non-sensitive params and token expiry for reuse | MDN localStorage |
Boot sequence
- Detect or load the SDK from the official CDN.
- Parse URL parameters,
clientId
,env
, optionaldebug
. - If a valid token exists in localStorage, reuse it. Otherwise, initiate
loginImplicitGrant(clientId, redirectUri)
. - After redirect back, capture
#access_token
, compute expiry, set the token on the SDK client. - Expose
window.gcClient
andwindow.gcPlatformClient
for immediate API calls.
How do I use it?
1. Create an OAuth client
- In Genesys Cloud Admin, go to IT and Integrations then OAuth then Add a client.
- Grant Type: Token Implicit Grant, Browser.
- Authorized redirect URIs: exact URL of your hosted LAC HTML file, for example:
https://www.talkingscientist.com/example/gc-lac-starter.html
. - Scope: least privilege, for example:
analytics conversations notifications presence routing:readonly users:readonly
. - Save, copy the Client ID. The Client Secret is not used by Implicit in the browser, store it securely and never ship it.
Helpful references
2. Host the page
Serve gc-lac-starter.html
from any HTTPS host, for example a static site, S3, or a local dev server.
3. Launch with parameters
https://<your-host>/gc-lac-starter.html?clientId=<YOUR_CLIENT_ID>&env=usw2.pure.cloud&debug=true
clientId
: your OAuth Client IDenv
: region base domain, for exampleusw2.pure.cloud
,mypurecloud.com
,mypurecloud.ie
debug
: optional, set totrue
for verbose logs
4. Verify authentication
Open the browser console and look for messages like, SDK available and Authentication complete, LAC ready.
Run a quick smoke test:
<script>
(async () => {
if (!window.gcPlatformClient || !window.gcClient) {
return console.error('LAC not ready. Check clientId, env, redirect URI, scopes.');
}
const api = new window.gcPlatformClient.UsersApi();
const me = await api.getUsersMe();
console.log('Logged in as', me.name, me.id);
})();
</script>
Where do we go from here?
LAC is an on-ramp. With a token in hand, explore the Genesys Cloud platform capabilities:
Capability | SDK Module | Docs |
---|---|---|
Users and Presence | UsersApi , PresenceApi |
Users API |
Analytics and Reporting | AnalyticsApi |
Analytics API |
Conversations, voice and messaging | ConversationsApi |
Conversations API |
Notifications, real time events | NotificationsApi |
Notifications API overview |
Routing and Queues | RoutingApi , QueuesApi |
Routing API |
Next up: we will build a Reporting Dashboard POC that authenticates with LAC, subscribes to Notifications API topics, and visualizes queue metrics in real time. We will measure time to token, event lag, and update latency, then ship a minimal dashboard you can extend.