CthuluHoop
CthuluHoop

Reputation: 136

How to redirect the user to a new URL in ASP.net Core 1.1 MVC

I'm writing a web app in ASP.net Core 1.1 that needs to authorize a user by logging them in to their Microsoft.com account. I've followed the Authorization Code Flow to log the user in. I'm completely new to ASP.net in general, and have yet to find a way to direct the user's web browser to the /authorize endpoint like described in the documentation. I've seen mention of HTTP Redirect responses being used, but have found no actual examples of how to set that up.

I'm wanting to set my app up so that it should redirect the user to the /authorize endpoint on startup, with the redirect URL returning them to the home page of my site which will display a table which was seeded by using their access token to grab data from their calendar after they signed in.

Upvotes: 2

Views: 691

Answers (1)

Marc LaFleur
Marc LaFleur

Reputation: 33124

The term "redirect" is a bit misleading. Typically you simply provide an HTML link the user clicks to login:

<a href="https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=[APPLICATION ID]&response_type=code&redirect_uri=[REDIRECT URI]&scope=[SCOPE]">Login with your Microsoft Account</a>

Upvotes: 3

Related Questions