Open niskah-energies opened 4 years ago
@niskah-energies Looks like you are missing the CallbackComponent
to parse tokens from the redirect URL, can you try the okta angular sample to see if you still can reproduce the issue?
P.S. you may need to upgrade the version of @okta/okta-angular
in the sample.
Hi @shuowu, thank you for your reply. I'm using OktaAuthComponent, everything works before I update package.
When I'm trying to call /login
route, I just have a blank page with no errors, before package update it redirects to Okta portal, but now there is no redirection.
My route file:
import { OKTA_CONFIG, OktaAuthModule, OktaAuthGuard, OktaAuthService, OktaLoginRedirectComponent, OktaCallbackComponent } from '@okta/okta-angular';
...
const oktaConfig = {
issuer: 'https://dev-xxxxx.okta.com/oauth2/default',
redirectUri: window.location.origin + '/implicit/callback',
clientId: 'xxxxx',
scopes: ['openid', 'profile', 'email', 'offline_access'],
pkce: true
/*isAuthenticated: async function(authService: OktaAuthService) { // https://github.com/okta/okta-oidc-js/issues/460 - https://github.com/okta/okta-oidc-js/tree/master/packages/okta-angular
const accessToken = await authService.getAccessToken();
const idToken = await authService.getIdToken();
return !!(accessToken && idToken);
}*/
};
{
path: '',
component: LandingLayoutComponent,
children: [
{ path: '', component: LandingComponent, pathMatch: 'full'}
//{ path: 'landing', component: LandingComponent }
]
},
{
path: 'login',
component: OktaLoginRedirectComponent
},
...
{
path: 'implicit/callback',
component: OktaCallbackComponent
},
{ path: '**', redirectTo: '' }
];
@NgModule({
declarations: [
HomeComponent
],
imports: [
CommonModule,
HttpClientModule,
OktaAuthModule,
RouterModule.forRoot(routes)
],
providers: [
{ provide: OKTA_CONFIG, useValue: oktaConfig/*, multi:false*/ },
{ provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true }
],
exports: [RouterModule]
})
export class AuthRoutingModule { }
@niskah-energies By glancing at the code, I don't see the cause of the issue.
Some suggestions:
offline_access
in scopesHttpInterceptor
If you can reach out to our support team at developers@okta.com you can share details of your configuration and they can help us find out what is happening.
I'm trying without HttpInterceptor ut it's the same, maybe problem leaves in OktaLoginRedirectComponent
I'm submitting this issue for the package(s):
I'm submitting a:
Current behavior
AuthService login() function don't do anything and no errors
Expected behavior
trying to login with OKTA portal
Minimal reproduction of the problem with instructions
Extra information about the use case/user story you are trying to implement
Environment
node -v
): v10.15.1