0

I have to redirect user to external identity provider while user is not authenticated, but I must do it with parameters sent as application/x-www-form-urlencoded. How can I do it? This is my current code of AuthenticationHandler:

protected override async Task<AuthenticateResult> HandleRemoteAuthenticateAsync() { Response.ContentType = "application/x-www-form-urlencoded"; Response.Redirect($"{Options.Authority}/authorization"); } 

2 Answers 2

1

Response.Redirect means it will tell the client to redirect. The redirect happened at the client and it will just return two 301 and 302 status codes.

Details, you could refer to this article.

If you want to send some response body to client and redirect, you could get the url and body, then use js code to redirect to the right url and formdata.

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

Comments

0

why do you want to redirect users from the back-end (your server)? you can do it easily by JS!

you just need to prepare authentication parameters from the server and combine them with the third-party address and redirect users by JS

1 Comment

Because I just must. You know how to do it?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.