Skip to content

Commit

Permalink
chore: Use /login/callback instead of /implicit/callback
Browse files Browse the repository at this point in the history
OKTA-324375
<<<Jenkins Check-In of Tested SHA: 30f12eb for [email protected]>>>
Artifact: okta-angular
  • Loading branch information
denysoblohin-okta authored and eng-prod-CI-bot-okta committed Mar 6, 2021
1 parent 9992737 commit cc5b05e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ import {
const oktaConfig = {
issuer: 'https://{yourOktaDomain}.com/oauth2/default',
clientId: '{clientId}',
redirectUri: window.location.origin + '/implicit/callback'
redirectUri: window.location.origin + '/login/callback'
}

@NgModule({
Expand Down Expand Up @@ -170,7 +170,7 @@ If a user does not have a valid session, then a new authorization flow will begi

Used by the login redirect flow, begun by a call to [signInWithRedirect](https://github.com/okta/okta-auth-js#signinwithredirectoptions). This component handles the callback after the redirect. By default, it parses the tokens from the uri, stores them, then redirects to `/`. If a protected route (using [`OktaAuthGuard`](#oktaauthguard)) caused the redirect, then the callback will redirect back to the protected route. If an error is thrown while processing tokens, the component will display the error and not perform any redirect. This logic can be customized by copying the component to your own source tree and modified as needed. For example, you may want to capture or display errors differently or provide a helpful link for your users in case they encounter an error on the callback route. The most common error is the user does not have permission to access the application. In this case, they may be able to contact an administrator to obtain access.

You should define a route to handle the callback URL (`/implicit/callback` by default). Also add `OktaCallbackComponent` to the declarations section of in your `NgModule`.
You should define a route to handle the callback URL (`/login/callback` by default). Also add `OktaCallbackComponent` to the declarations section of in your `NgModule`.

```typescript
// myApp.module.ts
Expand All @@ -181,7 +181,7 @@ import {

const appRoutes: Routes = [
{
path: 'implicit/callback',
path: 'login/callback',
component: OktaCallbackComponent
},
...
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/harness/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const appRoutes: Routes = [
component: SessionTokenLoginComponent
},
{
path: 'implicit/callback',
path: 'login/callback',
component: OktaCallbackComponent
},
{
Expand Down Expand Up @@ -99,7 +99,7 @@ const appRoutes: Routes = [
// On the callback load we detect PKCE by inspecting the pathname
const url = new URL(window.location.href);
const pkce = !!url.searchParams.get('pkce') || url.pathname.indexOf('pkce/callback') >= 0;
const redirectUri = window.location.origin + (pkce ? '/pkce/callback' : '/implicit/callback');
const redirectUri = window.location.origin + (pkce ? '/pkce/callback' : '/login/callback');

const config = {
issuer: process.env.ISSUER,
Expand Down

0 comments on commit cc5b05e

Please sign in to comment.