I'll probably add something like clearAccessToken. So it doesn't affect existing typescript code from other people modifying from string to string | null.
But this won't be done immediately. We are working on some other builds issues and I'll be out of office starting next week. If I can push something before I leave (so it is taken into account in next builds), I'll do it. Otherwise it may be in first days in January.
Original Message:
Sent: 12-18-2025 14:32
From: Nick Tait
Subject: Enhance loginPKCEGrant method to support "prompt:login" option (in LoginPKCEGrantOptions)
I've raised a support case (#0003941903) for API Explorer PKCE SSO loop.
I suppose the other question I have is whether the Typescript definition for setAccessToken should be updated to allow null to be passed as a parameter?
setAccessToken(token: string | null): void;
Or alternatively create a separate method?
clearAccessToken(): void;
------------------------------
Nick Tait
Genesys Consultant
Original Message:
Sent: 12-18-2025 14:11
From: Nick Tait
Subject: Enhance loginPKCEGrant method to support "prompt:login" option (in LoginPKCEGrantOptions)
Hi Jerome.
I was assuming that the same issue that I have with API Explorer with Prompt for login ticked would be experienced by anyone using Microsoft SSO. But you are correct we probably need that assumption confirmed.
I'll raise a support case as per your suggestion.
Nick.
------------------------------
Nick Tait
Genesys Consultant
Original Message:
Sent: 12-18-2025 10:26
From: Jerome Saint-Marc
Subject: Enhance loginPKCEGrant method to support "prompt:login" option (in LoginPKCEGrantOptions)
Hello Nick,
I am not following your last statements.
"I'd be keen to retest the behaviour after Genesys (hopefully) resolves the (same) authentication loop with API Explorer (when ticking 'Prompt for login' option)?"
It probably has nothing to do with API Explorer, as you are facing the same with the SDK and your app when you use prompt:login. The two are just following the authorize and token urls to be used for OAuth PKCE login.
It is either something specific to PKCE Auth flow (and in that case, it might be worth reporting it to Support, at least for tracking or for investigation - not mentioning SDK or API Explorer but the OAuth PKCE Grant flow) or to your Multi-SSO setup.
Regards,
------------------------------
Jerome Saint-Marc
Senior Development Support Engineer
Original Message:
Sent: 12-17-2025 21:16
From: Nick Tait
Subject: Enhance loginPKCEGrant method to support "prompt:login" option (in LoginPKCEGrantOptions)
Hi Jerome.
Thanks for those suggestions. I can confirm that using setAccessToken(null) before loginPKCEGrant achieves the same thing as the fetch (i.e. causes loginPKCEGrant to redirect rather than using a cached token). Although one minor complaint is because I'm using Typescript, an error is reported due to the function expecting a string argument, not a null. So for now I think I'll stick with fetch.
Also I'm using a single Client ID for my application (with access to multiple orgs), and as you suspected that means that in 'scenario 3' (i.e. redirecting for authentication shortly after having authenticated for the same application), without prompt=login, SSO redirects back without prompting for the org. (And with prompt=login, gets stuck in the authentication loop.)
I'm happy to park this issue for now if you like? I'd be keen to retest the behaviour after Genesys (hopefully) resolves the (same) authentication loop with API Explorer (when ticking 'Prompt for login' option)?
Thanks for your help, and have a great Christmas!
------------------------------
Nick Tait
Genesys Consultant
Original Message:
Sent: 12-16-2025 05:23
From: Jerome Saint-Marc
Subject: Enhance loginPKCEGrant method to support "prompt:login" option (in LoginPKCEGrantOptions)
Hello,
I don't have SSO in my test environment. So I unfortunately can't try myself.
Something I didn't think about, as you mentioned that you have setPersistSettings(false) -> I am not saying this will change outcomes in your test scenario. But to simplify the code, and possibly avoid the use of fetch (and the code I provided in my previous post), to only use loginImplicitGrant/loginPKCEGrant on every page load or redirect. You could just reset the access token which is stored as global variable, and then invoke loginImplicitGrant/loginPKCEGrant (with or without prompt:login) -> apiClient.setAccessToken(null)
The test on existing access token will "fail" and should then call the function like if it was a first load.
In your scenario, I was not clear if you are changing the clientId. If yes, I assume it should bring you to a login page (even without prompt:login). If not, probably not (unless you still make use of prompt:login).
Regards,
------------------------------
Jerome Saint-Marc
Senior Development Support Engineer
Original Message:
Sent: 12-15-2025 23:11
From: Nick Tait
Subject: Enhance loginPKCEGrant method to support "prompt:login" option (in LoginPKCEGrantOptions)
Hi Jerome.
Thanks for the ideas.
I had a bit of a play with including (in fetch URL parameters) org and provider, and also target, but it didn't change anything as far as the behaviour I'm seeing.
I also tried experimenting with changing the app to check when the page loads if sessionStorage.getItem('genesys_cloud_sdk_pkce_code_verifier') == null and if so, include "prompt:login" in the opts passed to loginPKCEGrant, but that also ended up in an authentication loop, which kind of supports my theory that the back end (performing the authentication) can't handle prompt:login with PKCE? If so I'm thinking that the only way to get this to work is to get the back-end fixed? And hopefully if that happens my app with the current workaround (thanks to yourself) will start working?
Thanks,
------------------------------
Nick Tait
Genesys Consultant
Original Message:
Sent: 12-15-2025 02:49
From: Jerome Saint-Marc
Subject: Enhance loginPKCEGrant method to support "prompt:login" option (in LoginPKCEGrantOptions)
Hello Nick,
"Also just FYI I'm using setPersistSettings(false).". If you are opening a new tab/window, that could possibly work calling loginImplicitGrant or loginPKCEGrant twice (still with the issue with you are facing now). But if it is from an existing tab that already loaded the lib and logged in on a different org, it will take a saved token stored as global variable.
"I'm sure this used to work OK, but maybe the API Explorer has only recently been updated to use PKCE instead of Implicit login" I don't know the exact status but yes, they are in the process of migrating the login to PKCE Grant on API Explorer.
I understand you may not know all the orgs in advance, but it could be interesting to see what happens if you provide the provider and org auth parameters when you fetch the url (if it allows to skip this page you see or not). If the SSO provider has been created recently, I think the value of the provider is now the id of the SSO provider in GC configuration (was done to allow multiple SSO providers of the same type). If it is a legacy SSO provider config, then it should be among the values as it is in the doc ("okta", "adfs", "salesforce", "onelogin", "gsuite", or "ping").
Regards,
------------------------------
Jerome Saint-Marc
Senior Development Support Engineer
Original Message:
Sent: 12-14-2025 17:00
From: Nick Tait
Subject: Enhance loginPKCEGrant method to support "prompt:login" option (in LoginPKCEGrantOptions)
Hi Jerome.
Thanks so much for creating the new version to test this with...
By the way all your assumptions based on how I'm using this were right. Also just FYI I'm using setPersistSettings(false).
You were 100% correct that including prompt:login in the opts passed into loginPKCEGrant isn't sufficient to force the user to log in due to loginPKCEGrant checking for a saved token before performing the redirection.
So I tried the workaround you provided above, and almost worked... In fact I believe the workaround itself is perfect, but it seems that there is something funny going on with Microsoft SSO when you are using PKCE and include prompt=login in the URL? The reason I say that is because I was trying to work out what I needed to do by comparing the redirection URL being fetched by my application with the redirection URL used by the Platform API Explorer when you tick the Prompt for Login box, before realising that the API Explorer exhibits the exact same issue:
- The browser redirects to
https://login.mypurecloud.com.au/oauth/authorize?client_id=...&response_type=code&redirect_uri=...&code_challenge=...&code_challenge_method=S256&state=...&prompt=login - The Genesys Cloud login page saying "Log in with your account:" and the Microsoft icon is presented to the user:

- The user clicks on the Microsoft icon to login with SSO.
- At this point the browser should be redirected back to the application, but instead the user is presented again with the the Genesys Cloud login page saying "Log in with your account:" and the Microsoft icon. i.e. GOTO Step 2.
I'm sure this used to work OK, but maybe the API Explorer has only recently been updated to use PKCE instead of Implicit login, and that has caused this to stop working?
I wondered whether this could be a problem with our SSO, but unfortunately I don't have any orgs using other Entra ID providers to test with.
So I think I'll continue using your workaround, and hope that at some stage the loop that is exhibited by API Explorer gets resolved, at which point my app will hopefully work too?
Nick.
P.S. This is the API Explorer Prompt for Login box:

------------------------------
Nick Tait
Genesys Consultant
Original Message:
Sent: 12-12-2025 09:29
From: Jerome Saint-Marc
Subject: Enhance loginPKCEGrant method to support "prompt:login" option (in LoginPKCEGrantOptions)
Hello,
I have exposed prompt auth parameter in the loginImplicitGrant and the loginPKCEGrant methods (through opts parameter). It is available in version 241.0.0.
But as explained in my previous post, if I correctly understood your use of fetch for the Login Implicit Grant flow, you'llk probably have to do something similar to the code I put in my post.
Regards,
------------------------------
Jerome Saint-Marc
Senior Development Support Engineer
Original Message:
Sent: 12-11-2025 23:03
From: Nick Tait
Subject: Enhance loginPKCEGrant method to support "prompt:login" option (in LoginPKCEGrantOptions)
I have written a web application that I use with many Genesys Cloud orgs. It uses the JavaScript PSDK, and summarises license usage.
I recently updated the application to use loginPKCEGrant instead of loginImplicitGrant to authenticate the user (using SSO). This happens when the app is loaded in the browser, and the user is redirected to Microsoft for SSO, and one of the following occurs:
- If they haven't recently (in the same browsing session) authenticated to Genesys Cloud, they are prompted for their username and password and MFA, and then they are prompted for which Genesys Cloud org they want to use. And they are redirected back to the app where the PKCE stuff completes and they then have a valid token for the selected org.
- If they have recently (in the same browsing session) authenticated to Genesys Cloud using a different Genesys Cloud application, it skips asking for their credentials and they are simply asked for which Genesys Cloud org they want to use. And they are redirected back to the app where the PKCE stuff completes and they then have a valid token for the selected org.
- If they have recently (in the same browsing session) authenticated to Genesys Cloud using the same Genesys Cloud application, it skips asking for their credentials and the org, and redirects them back to the app where the PKCE stuff completes and they then have a valid token for the same org they originally selected.
Since I want to use this app with multiple orgs, I'm looking for a way to get the 3rd scenario above to prompt the user for the org.
When I was using Implicit Grant, I could do a fetch() to replicate the loginImplicitGrant redirection, and include "&prompt=login" in the the URL, and that would cause SSO to ask them for the org. Then when the user was redirected back to the app they had a valid token.
But this doesn't work with PKCE Grant due to the PKCE challenge stuff.
So what I'd like to request is that the LoginPKCEGrantOptions class is enhanced to support "prompt:login", and then include that in the URL parameters when the redirection occurs?
Thanks.
#PlatformSDK
------------------------------
Nick Tait
Genesys Consultant
------------------------------