1

I am using ASP.Net core 2.2. I redirect to an identity server instance, which then redirects back to my MVC app. The redirect back url is of the form:

http://localhost:8081/home/fetchtokenresponse#id_token=longtokenvalue&token_type=Bearer&expires_in=3600&scope=myscopes&session_state=jizlw_6DiGhYvkGk6fKRKkhZQoFlYKJ5v1_2Lwd-caI.MN0g0HwpGuulkwKleHtJCg

In my action I want to be able to read the parameters like

public IActionResult FetchTokenResponse(string id_token)

What I have tried

I tried adding a new route with a has tag, but this appears to be illegal:

routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}#{id?}");

Is there another way to intercept the path and redirect to my action?

2
  • Why do you want to do this? The id_token most likely only contains the sub claim (by default), and if not (because you may have set options.GetClaimsFromUserInfoEndpoint = true), these claims are automatically added to the cookie. Commented Mar 18, 2020 at 18:43
  • The access_token is in there too, I probably haven't shown this very well. What I have is an application using LDAP authentication, but it needs to call into different clusters for various reasons and needs to authenticate into them. Commented Mar 19, 2020 at 7:46

1 Answer 1

1

You will need to modify your authentication request to IdentityServer to use response_mode=form_post or response_mode=query.

Fragments are not sent to the server, as defined in: https://blog.httpwatch.com/2011/03/01/6-things-you-should-know-about-fragment-urls/. Fragment response mode is used when you want your front-end JavaScript to grab the tokens.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.