Swagger with .net API and Google IdP redirecting to Okta dashboard

I have an API written in .net that uses swagger to test the API. Once the API is loaded, if I click on the Authorize button, it shows the following config:

Authorization URL: https://dev-********.okta.com/oauth2/default/v1/authorize

Token URL: https://dev-********.okta.com/oauth2/default/v1/token

Flow: authorizationCode with PKCE

The redirect URI is: https://localhost:7151/swagger/oauth2-redirect.html and I’ve added that redirect uri to OKTA.

Now if I select to login using email and code, it redirects to my API just fine after authentication. But when I choose my google IdP it only ever redirects me to the okta dashboard of the user that signed in.

I’ve done some experiments and discovered that if I use the following url to test the connection:

https://dev-********.okta.com/oauth2/v1/authorize?idp=*********&client_id=**********&response_type=id_token&response_mode=fragment&scope=openid%20email&redirect_uri=https://localhost:7151/swagger/oauth2-redirect.html%2F&state=WM6D&nonce=YsG76jo

It accurately loads the google account login, and when I authenticate it redirects me properly.

However, when I go through swagger, and then I select “Sign in with Google” it brings me to:

https://okta-devok12.okta.com/sso/idps/****** and when I authenticate it drops me at my user’s okta account dashboard instead of navigating to the redirect_uri passed from swagger.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.