oidc-client
oidc-client copied to clipboard
Callback not caught, URL with obtained code remains in the browser
Issue and Steps to Reproduce
Using Azure as Identity provider makes Callback not called, also tried with sample application by changing only the relevant categories in configuration.
Versions
6.4.18
Screenshots

Expected
Callback gets executed and you can retrieve the access token
Actual
Additional Details
- Installed packages:
hi @nikPast , Thank you very much for your issue.
Do you have a sample of your configuration?
Sure, please note that I'm hiding client_id and tenant_id for policy. const configuration = { client_id: '**', redirect_uri: window.location.origin + '/authentication/callback', silent_redirect_uri: window.location.origin + '/authentication/silent-callback', // Optional activate silent-signin that use cookies between OIDC server and client javascript to restore the session scope: 'openid profile email offline_access', authority: 'https://login.microsoftonline.com//v2.0', service_worker_relative_url: '/OidcServiceWorker.js', service_worker_only: true, };
thank you @nikPast, do you have an error log or something else in the console?
You try without service worker first for simplicity:
const configuration = {
client_id: '**************************',
redirect_uri: window.location.origin + '/authentication/callback',
silent_redirect_uri: window.location.origin + '/authentication/silent-callback', // Optional activate silent-signin that use cookies between OIDC server and client javascript to restore the session
scope: 'openid profile email offline_access',
authority: 'https://login.microsoftonline.com/************************/v2.0',
};
I did it and in neither the cases I found any error
hi @nikPast , did you removed previous service worker registration before your test ?
do you have the your OidcProvider setting Code ? it seem the OIdcProvider never called during the callback route.

Thank you @nikPast for your feedbaks.
Which logs do you have if you logs events?
https://github.com/AxaGuilDEv/react-oidc/blob/a6b607a3c29b3fd55c799550936e45e1863cd3d1/packages/react/src/App.tsx#L40
Which azure Service are you using? I may try to reproduce it.
Hi, I don't log events, to reproduce it just create a new app registration in azure and follow the basic authentication process to that application. Azure offers a free account for creating an application
I don't know if it can help, but through the callback url from azure it returns {code, state, sessionstate}, no issuer, no scopes in the url. Following the demo with Identity4 these last parameters are returned, could be the issue?
Thank you @nikPast for your help? Do you know the azure step your are using to create an azure Authentification Compoment? for example the name of the resource your are creating? I need just more information to understand what youare using on azure.
yes may be no scope may be bring a problem for example.
The process is: Create a new app in azure portal. Retrieve clientID and tenantID from there. The authority url is: https://login.microsoftonline.com/tenantID/v2.0. you can use any scope including the one included in your example. It just misses the callback, the authentication code is correctly returned inside the browser url but not handled by the library.
Thank you @nikPast for your information.
I do not understand wich resource I need to create :
I'am used to webapp but it does not create any auth provider.
@nikPast
I am working on an app at the moment, against Azure AD B2C.
Using the demo in the repo, I can get receive callback and app authentication works as expected.
Because i haven't exposed any API or added API permissions to the app, I removed api
from the scope demands,
and change token_renew_mode
to id_token_invalid
.
My config looks similar to yours:
export const configurationMicrosoftB2C = {
client_id: 'xxxx',
redirect_uri: window.location.origin + '/authentication/callback',
silent_redirect_uri: window.location.origin + '/authentication/silent-callback',
scope: 'openid profile email offline_access',
authority: 'https://{tenant}.b2clogin.com/tfp/{tenant}/b2c_1_{tenant}/v2.0/',
refresh_time_before_tokens_expiration_in_second: 40,
service_worker_relative_url: '/OidcServiceWorker.js',
service_worker_only: false,
token_renew_mode: 'id_token_invalid',
};
The only other setting I think I modified was in the user flow, set the Claim representing user flow
to tfp
.