Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when httpRequest deletes STATE_TOKEN_KEY_NAME from storage #1493

Open
rthm93 opened this issue Feb 7, 2024 · 4 comments
Open

Error when httpRequest deletes STATE_TOKEN_KEY_NAME from storage #1493

rthm93 opened this issue Feb 7, 2024 · 4 comments
Labels

Comments

@rthm93
Copy link

rthm93 commented Feb 7, 2024

Describe the bug

The error attributes[attributeName].split is not a function was throw when I called OktaAuth.signout(). I have dug into okta-auth-js's source code and found that the error was throw from this line.

The storage.delete's implementation is found in here in browser/browserStorage.

Reproduction Steps?

The following is a min version of my AuthService in Angular:

@Injectable({
  providedIn: 'root'
})
export class AuthService {
    constructor(private oktaStateService: OktaAuthStateService, @Inject(OKTA_AUTH) private oktaAuth: OktaAuth) {}

   async logout() {
        await oktaAuth.signout();
   }
}

The following is a screenshot of my chrome debugger:
image

SDK Versions

System:
OS: Linux 5.15 Oracle Linux Server 8.9
CPU: (16) x64 12th Gen Intel(R) Core(TM) i7-1260P
Memory: 15.21 GB / 30.65 GB
Container: Yes
Shell: 4.4.20 - /bin/bash
Binaries:
Node: 18.19.0 - ~/.nvm/versions/node/v18.19.0/bin/node
npm: 10.2.3 - ~/.nvm/versions/node/v18.19.0/bin/npm
Browsers:
Chrome: 121.0.6167.139
npmPackages:
@okta/okta-angular: ^6.3.2 => 6.3.2
@okta/okta-auth-js: ^7.5.0 => 7.5.0

Additional Information?

No response

@rthm93 rthm93 added the bug label Feb 7, 2024
@rthm93
Copy link
Author

rthm93 commented Feb 7, 2024

The walkaround I am using now is to override the storageUtil in the OktaAuthOptions like the following:

new OktaAuth({
    ...
    storageUtil: {
        // Custom implementation
    }
})

@jaredperreault-okta
Copy link
Contributor

Can you share your full OktaAuth config (please sanitize sensitive properties)

@rthm93
Copy link
Author

rthm93 commented Feb 8, 2024

I am using OktaAngular, the following is how I provide the OktaAuth.

export const OktaConfigProvide: Provider = {
  provide: OKTA_CONFIG,
  useFactory: (appConfigService: ConfigurationService) => ({
    oktaAuth: new OktaAuth({
      issuer: appConfigService.config.oktaIssuer,
      clientId: appConfigService.config.oktaClientId,
      redirectUri: window.location.origin + '/login-callback',
      scopes: ['openid', 'profile']
    })
  }),
  deps: [ConfigurationService]
}

my app.module.ts:

@NgModule({
    imports: [..., OktaAuthModule],
    providers: [..., OktaConfigProvide]
})
export class AppModule {}

@shuowu-okta
Copy link
Contributor

@rthm93 Thanks for reporting the issue! Our team will look into it.
Internal ref: OKTA-697135

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants