I put this together to help me understand using the SDK and have something to quick start ideas that I want to mess with. I thought I'd share with the community as a hello. You can see from my icon that I work for Genesys so I should say yes I do but I'm posting this as that guy from the internet that happens to work for Genesys, not that guy from Genesys that is posting production ready code that you should deploy. So this has no warranty or support. If you claim otherwise I will disavow you. I will deny knowing you. I will have 5 friends confirm that I was at the movies with them the whole time and you wrote it yourself.
Lab coats on, sharpen your pencils and let's sling some code:
Abstract:
A minimal HTML file that loads the Genesys Cloud SDK, runs OAuth Implicit Grant, and caches the token for reuse. Ideal for POCs and demos.
How does it work?
- Loads SDK from the official CDN or uses an existing global.
- Reads `clientId`, `env`, `debug` from the URL.
- Reuses a valid token from localStorage if present, otherwise calls `loginImplicitGrant()`, then stores the new token.
- Exposes `window.gcClient` and `window.gcPlatformClient` for immediate API calls.
References:
- SDK docs: Genesys Cloud Developer Center
- Implicit Grant guide: Genesys Cloud Developer Center
- MDN localStorage: Window: localStorage property - Web APIs | MDN
How do I use it?
- Create an OAuth client in Admin, IT and Integrations -> OAuth -> Add a client
- Grant Type: Token Implicit Grant, Browser
- Authorized redirect URIs: exact URL of your LAC page
- Scope: least privilege, for example `analytics conversations notifications presence routing:readonly users:readonly`
- Docs, Create an OAuth client: https://help.mypurecloud.com/articles/create-an-oauth-client/
- Scopes reference: https://help.mypurecloud.com/articles/about-oauth-scopes-for-applications/
- Regions and required domains:Required Genesys Cloud domains - Genesys Cloud Resource Center
- Host the page over HTTPS.
- Open it with parameters:
- `clientId`: your OAuth Client ID
- `env`: region base domain, for example `usw2.pure.cloud`, `mypurecloud.com`, `mypurecloud.ie`
- `debug`: optional, `true` for verbose logs
I almost forgot the actual link:
GenesysClientApps/gc-lac-starter.html at main · talkingscientist/GenesysClientApps
| GitHub |
remove preview |
|
| GenesysClientApps/gc-lac-starter.html at main · talkingscientist/GenesysClientApps |
| Contribute to talkingscientist/GenesysClientApps development by creating an account on GitHub. |
| View this on GitHub > |
|
|
#PlatformSDK
------------------------------
Allen Coley
Senior Principal PS Consultant
------------------------------