navin
October 3, 2019, 1:06pm
1
In my Angular application, I am using @okta /okta-signin-widget with okta client id. My requirement is to use window.location.origin as redirect_uri .
import { NgModule } from ‘@angular /core’;
import { AppComponent } from ‘./app.component’;
import { RoutesModule } from ‘./routes/routes.module’;
import { OktaAuthModule } from ‘@okta /okta-angular’;
// Okta configuration
const oktaConfig = {
issuer: ‘https://dev-836625.oktapreview.com/oauth2/default ’,
redirectUri: window.location.origin,
clientId: ‘xxxXXXxxXxxx’,
scope: ‘openid profile email’
};
@NgModule ({
declarations: [
AppComponent
],
imports: [
OktaAuthModule.initAuth(oktaConfig),
RoutesModule,
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
But after login, redirect_uri is returned as null. Please find the attachment
Help much appreciated!
Hi there, you need to register you redirect url in your app so if you want a dynamic redirect url then you will have to add all possible urls or update the app each time with the new url.
navin
October 3, 2019, 1:38pm
3
I am very beginner to OKTA, Could you please give me an example like how and where I can add all the URLs in the app
Govner
October 3, 2019, 1:40pm
4
You will need to gather the value of your redirect url (i’m not sure what the value of window.location.origin is but you will have to find out).
The go to your app and to the app’s general tab. You will then need to add the window.location.origin to the login redirect url.
I forgot to add but ensure it is 100% accurate down to the final ‘/’ as Okta will refuse anything that isn’t an exact match.
1 Like
system
Closed
January 23, 2024, 7:25pm
7
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.