Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set logout link for react-oidc-context #1490

Open
rcbandit111 opened this issue Feb 6, 2025 · 3 comments
Open

Set logout link for react-oidc-context #1490

rcbandit111 opened this issue Feb 6, 2025 · 3 comments

Comments

@rcbandit111
Copy link

I use this code to logout user:

const signOut: JwtAuthContextType['signOut'] = useCallback(() => {
        removeTokenStorageValue();
        removeGlobalHeaders(['Authorization']);
        setAuthState({
            authStatus: 'unauthenticated',
            isAuthenticated: false,
            user: null
        });
        auth.signoutRedirect();
    }, [removeTokenStorageValue]);

When I call it I'm redirected to http://host:8080/logout?id_token_hint=eyJraWQiOi.......

I need to set a custom logout url: http://host:8080/connect/logout?id_token_hint=eyJraWQiOi......

Do you know how I can configure this?

@zach-betz-hln
Copy link

Hi @rcbandit111 - auth.signoutRedirect() accepts an args object. You could potentially pass your custom URL like this:

auth.signoutRedirect({ post_logout_redirect_uri: 'https://example.com/' })

Or, wherever you new up your UserManager you can set the post_logout_redirect_uri there. Example.

@rcbandit111
Copy link
Author

rcbandit111 commented Feb 6, 2025

I tested but unfortunately it's not working. The url is not replaced. By the way I use Spring Authorization Server if this has any impact. Other solutions?

@zach-betz-hln
Copy link

I don't have any other ideas, sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants