AxaFrance / oidc-client

Light, Secure, Pure Javascript OIDC (Open ID Connect) Client. We provide also a REACT wrapper (compatible NextJS, etc.).
MIT License
570 stars 152 forks source link

Potential issue after login on restricted path #1348

Closed allemas closed 2 months ago

allemas commented 2 months ago

When user try to access to a restricted URL address directly not logged in, the redirection to the identity provider occur, the user can login but the user is not redirected to the initial targeted page.

Here my configuration :

const configuration = {
    client_id: OIDC_CLIENT_ID,
    redirect_uri: window.location.origin + "/oauth-redirect",
    silent_redirect_uri:
        window.location.origin + "/authentication/silent-callback",
    scope: "openid email profile",
    authority: "https://accounts.google.com",
    service_worker_only: false,
    token_request_extras: {
        client_secret: CLIENT_SECRET,
    }
};

I searched into the documentation, I miss something maybe. I don't know if the feature exist in the lib, that why I open an issue, hope it's ok.

I think, it's comes from the fact that redirect_uri is hard coded, I wonder if redirect mechanism can be applied here like, window.location.origin + "/oauth-redirect?redirect=<url>", otherwise I'll have to set up a redirection mechanism in localstorage, too bad :(

guillaume-chervet commented 2 months ago

Hi @allemas , thank you for your issue. The behavior you seem to need is the default behavior. Checkout the demo to test. You may have something in your code that should disturb this default behavior.

allemas commented 2 months ago

I found a workaround, a business rule blocked default behavior Thanks you ! I can now close the issue !