Implicite flow okta 400 error

hi team,
I integrate okta in my projet, its work very good in localhost:4200, but when I build my project angular ng build --prod --base-href /liris/ --deploy-url /liris/ , I have a folder in dist , when I put my folder tomcat , and I change conf okta
http://localhost:8080/liris/authSuccess instead of http://localhost:4200/authSuccess I end up with error 400 page of okta ,

const oktaConfig= {
issuer: ‘https://dev-905229.okta.com/oauth2/default’,
redirectUri: window.location.origin.concat(’/authSuccess’),
clientId: ‘0oabot6zqATvLRsRO4x6’,
scope: ‘openid email’
}


entryComponents: [TimeOutModalComponent],
providers: [{provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true},
{provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true},
{provide: LOCALE_ID, useValue: ‘fr’},
{ provide: OKTA_CONFIG, useValue: oktaConfig },
{provide: ErrorHandler, useClass: GlobalErrorHandler}],
bootstrap: [AppComponent]
})

can you help me

Look at the address bar when you see the 400 error. The redirect URI it’s trying to go to will be a parameter in the URL. If you add that value in your app’s login redirect URI’s, it’ll work.

in my address bar i’have https://dev-905229.okta.com/oauth2/default/v1/authorize?client_id=0oabot6zqATvLRsRO4x6&nonce=TshraO4RiYD5FkJKPL9QbL3AclTV25h4Yxjw14FbA5pZkNLSVuXkEpM8lYRajBG1&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2FauthSuccess&response_mode=fragment&response_type=id_token%20token&state=hVRrksgvGZMqVbv53Vq1vTreKxilTJ0dhfz7srbAIrDwdo6ddAGjakkz6g5WN6xr&scope=openid%20email
in my conf okta
http://localhost:8080/liris/authSuccess

what should I add ?

If you look at the parameter, it says to use.

http://localhost:8080/authSuccess

If you want to use the one you already have configured, you need to add the context path in your Angular app.

yes when i build my angular i use ng build --prod --base-href /liris/ --deploy-url /liris/

I did another test ,I added the dist in a spring boot project with the context / liris but the same error message 400

“scripts”: {
“ng”: “ng”,
“start”: “ng serve”,
“build”: “ng build --prod --base-href /liris/ --deploy-url /liris/”,
“test”: “ng test”,
“lint”: “ng lint”,
“e2e”: “ng e2e”
}

https://github.com/mohamedberrahal/frontLiris/blob/master/angular.json

yes it’s working redirectUri: window.location.origin.concat(’/liris/authSuccess’),
thank very much matt

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.