Just started looking at using OKTA to manage our authentication requirements for a new Angular SPA and have implemented the OKTA sdk which works great however I am struggling to understand how the “offline_access” scope is managed.
My user should be able to login when the SPA is connected to the internet but when I disable my network connection I get errors from the OKTA sdk.
I am using the OktaAuthGuard as demonstrated within the documentation.
My config is: -
export const oktaAuthConfig = {
clientId: '{My ClientId}',
issuer: 'https://{MySubdomain}.okta.com',
redirectUri: 'http://localhost:4200/implicit/callback',
scopes: ['openid', 'profile', 'email'],
pkce: true
};
I have tried adding “offline_access” to my scopes but that just fails immediately with an AuthApiError with a 400 status when posting to /oauth2/v1/token.
If I run the app up and login then disable my network connection I get errors appearing in the console and I lose my claims which i access on my test page using: -
const userClaims = await this.oktaAuth.getUser();
this.userName = userClaims.name;