okta-angular icon indicating copy to clipboard operation
okta-angular copied to clipboard

Okta PKCE Flow AuthSdk Error when using Multiple Tabs

Open Shyamsj opened this issue 4 years ago • 3 comments

Current behavior

Login to the application and open the application in-multiple tabs and logout from all the tabs and try to re login with any one of the tab we get this Error : AuthSdkError: OAuth flow response state doesn't match request state After refreshing the page it works normally We are using Okta SDK "@okta/okta-angular": "^2.1.0"

Expected behavior

We not get the AuthSdkError it should land in to home page

Minimal reproduction of the problem with instructions

  • Login to the Okta SPA PKCE application

  • Open the application in-multiple tabs

  • logout from all the tabs

  • Try to re login with any one of the tab we get this

Error : AuthSdkError: OAuth flow response state doesn't match request state

Environment

  • OS: windows & mac
  • Browser: Chrome Safari & Firefox
  • .Net Framework:
  • Other: Okta SDK "@okta/okta-angular": "^2.1.0"

Sample Code implementation

login() { this.oktaAuth.loginRedirect('/'+ this.environment.logoutApp); }

logout() { this.oktaAuth.logout('/'+ this.environment.logoutApp); }

async isAuthenticated() { return await this.oktaAuth.isAuthenticated(); }

async getToken() { return await this.oktaAuth.getAccessToken(); }

const routes: Routes = [ { path: 'callback', component: OktaCallbackComponent, },

providers: [
AuthenticationService, HeaderEmitterService, [ { provide: HTTP_INTERCEPTORS, useClass: HeaderHttpInterceptor, multi: true }, { provide: HTTP_INTERCEPTORS, useClass: AdminHttpInterceptor, multi: true } ], { provide: OKTA_CONFIG, useValue: oktaConfig } ],

oidc: { issuer: "https://########.oktapreview.com/oauth2/default", clientId: "0o####################7", redirectUri: window.location.origin + "/callback", postLogoutRedirectUri: window.location.origin, scopes: ["openid", "profile", "email"], pkce: true, tokenManager: { autoRenew: true } }

Shyamsj avatar Sep 08 '20 10:09 Shyamsj

Hi @Shyamsj ,

Thanks for your issue.

This issue seems to be related to the okta-angular package instead of this SDK. I'm gonna transfer your issue to the proper repo.

laura-rodriguez avatar Sep 08 '20 15:09 laura-rodriguez

Similar issue here: https://github.com/okta/okta-oidc-js/issues/322#issuecomment-686362596

shuowu-okta avatar Sep 08 '20 15:09 shuowu-okta

@Shyamsj Can you try the latest version 3.1.0 to see if the issue still exist? See the migration guide here

shuowu avatar Jun 16 '21 21:06 shuowu