They gave me a application which has a home page says welcome and a utilites button which will display table to search when we click it . so i have to implement okta login page for this application.
these are the step i have followed ,
in environment.ts file i have created a oktaconfig function intialized okta details in it i have given redirect uri as localhost:8080/authorization-code/callback
in app.module.ts under imports i have added oktaauthmodule and in providers i have added okta_config usevalue environmnet.oktaconfig
in app.routing-module.ts file under routes i have added one route with path aauthorization-code/callback , component oktacallbackcomponent and added canactivate oktaauthguard to remaing routes like home and utilities . that the code i have added
so the issue is i can see the okta login page but when i succesfully logged in i am not able to see the welcome page and utilites functions are also not working please help me out.
Can you help me understand the layout of your app code? Is there a login button on the home page to start the authentication process? What route is your redirect callback set to? Can you share your routing module?
In case you haven’t seen it, here’s an example Angular app with a home page, 2 separate routes, plus authentication:
Can you share your routing module path declaration? I’m having difficulty understanding if there’s a default route without the OktaAuthGuard.
It sounds like a potential reason it’s not working is that you’re not authenticated before trying to navigate to /home. When you try navigating to /home, are you redirected to the Okta sign-in page? What happens if you enable route tracing to debug the routing for this path?
I tried this using the Angular Quickstart, and created a Home component housing the Okta login. I can sign in upon application load, sign in, and then see the menu (including Okta login).
Please note, I did change your routing module code, as CanActivate guard cannot be combined with redirect in the path. I don’t think it’s in Angular documentation, but I see an error when trying to start the app. See this commit
There’s probably something else going on. Can you provide a repro, even a condensed one so I can investigate more?
If not, you can try editing the Angular quickstart to match your setup