Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,

I am trying to implement login functionality using the package: angular-auth-oidc-client
for Angular 10 project.

I have gone through the documentation and have configured service but getting the error:

Message: redirect_uri_mismatch
Description: The redirection URI provided does not match a pre-registered value.

What I have tried:

I have written the configuration as mentioned below:

oidcConfigService.withConfig({
stsServer: 'https://xxxx/xxx/xx',
//redirectUrl: 'http://localhost:4200/callback',
redirectUrl: window.location.origin + '/callback',
clientId: 'client',
responseType: 'id_token token',
scope: 'openid email profile',
triggerAuthorizationResultEvent: true,
postLogoutRedirectUri: window.location.origin + '/logout',
startCheckSession: false,
silentRenew: false,
silentRenewUrl: window.location.origin + '/silent-renew.html',
postLoginRoute: '/home',
forbiddenRoute: '/forbidden',
unauthorizedRoute: '/unauthorized',
logLevel: LogLevel.Debug,
historyCleanupOff: true,
// iss_validation_off: false
// disable_iat_offset_validation: true
});

where, "Callback" is a component and I have a callback.ts file for that.
I want to redirect to that section and wanna perform some more actions there.
Posted
Updated 17-Aug-20 11:11am

1 solution

Was not aware of it. Looking at Google, seems the possible reason could be
Quote:
the redirection URI parameter being sent does not match the one registered for your client.

It means - when you have created your API key you set the URL redirect to an end point and you are using a different one in your code.

So, validate and make sure that the redirection URI is same in both the client and provider.
 
Share this answer
 
Comments
Member 11072126 18-Aug-20 0:07am    
Hi Sandeep, I found the issue. Now the callback url is working.
But, I have a callback component and i was expecting it will hit that component (wrote some code on ngInit of Callback component TS file). The control is not hitting there and moving directly to home page.
Do I need to set anything else which am missing out?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900