post_logout_redirect_uri with Google OAuth is not working

115 Views Asked by At

I am adding Google OAuth as authentication provider to our web application (.NET 7). We already support Azure OAuth and Okta OAuth. They both are added as OpenIdConnect using the following code snippet:

builder.Services.AddAuthentication(options => { options.DefaultAuthenticateScheme = domain; }).
                    AddOpenIdConnect(domain, options =>
                    {....

I want to add Google OAuth in the same way. The reason is that we want all our OAuth providers to be handled in the same manner. The login process with Google OAuth is working like a charm. The problem is the logout flow. When the logout in Google OAuth is done, the user should be redirected to our home page. We do this by including the post_logout_redirect_uri in the logout request to Google. The actual logout request is

https://www.google.com/accounts/Logout?client_id=...&post_logout_redirect_uri=...&id_token_hint=...&state=...

with at the dots the applicable values.

The result is that we are logged from google but after this we are not redirected to the url specified by post_logout_redirect_uri. Instead we are redirect to the login page of Google: https://accounts.google.com/InteractiveLogin/signinchooser?elo=1&...

I have also added the post logout redirect uri as authorized redirect URI in our Client ID for Web application with our Google OAuth 2.0 client registration. This however does not make a difference.

I tried with and without the client_id and id_token_hint parameters. I have read and tried other suggestions in other Stack Overflow articles and other support websites but none of the suggestions works.

I also tried https://accounts.google.com/Logout?continue=... but this gives a 400 error page.

Does this mean that Google OAuth does not support post_logout_redirect_uri, is our logout url missing parameters or ...?

Is there a way to fix this?

0

There are 0 best solutions below