authts / react-oidc-context

Lightweight auth library based on oidc-client-ts for React single page applications (SPA). Support for hooks and higher-order components (HOC).
MIT License
657 stars 64 forks source link

Safari download an empty logout file when I use signoutSilent method #883

Open gregoirebyvets opened 1 year ago

gregoirebyvets commented 1 year ago

Hello guys,

I'm quite newbie with oidc and I have an issue that I dont understand.

On Safari, when a user click on the "Logout" button (wich use signoutSilent() ), the browser ask if I want to download the "logout" file (from Keycloak logout url)

Do you know why I'm facing this ?

Thanks

pamapa commented 1 year ago

do you have a onClick handler? Can you dump your ui button code here?

gregoirebyvets commented 1 year ago

Here is my ui button code.

<HeaderButton onClick={() => auth.signoutSilent()}> Log out </HeaderButton>

And auth is provided by this line

const auth = useAuth();

pamapa commented 1 year ago

How does it look like rendered is it a <a> tag, which Safari reacts with download. Maybe try something else?

gregoirebyvets commented 1 year ago

It's actually a button:

<button tabindex="-1" class="bg-trinidad-500 font-normal text-white rounded-full px-3 py-2 mx-2 lg:px-6 lg:py-2 lg:mx-2 text-sm lg:text-base">Log out</button>

pamapa commented 1 year ago

no idea, you will need to track it down, does that button + onClick with a console.log("aha") and no auth.signoutSilent() also trigger the download?

gregoirebyvets commented 1 year ago

Ok thanks for your help, I'll investigate deeper and give a feedback if I find anything relevant