Skip to content

Instantly share code, notes, and snippets.

@xximjasonxx

xximjasonxx/login2.cs

Last active Jul 20, 2020
Embed
What would you like to do?
[HttpPost]
public IActionResult Login([FromForm]LoginFormViewModel viewModel)
{
var authClient = new AuthenticationApiClient("<your domain>.auth0.com");
var authUrl = authClient.BuildAuthorizationUrl()
.WithClient("<your client id>")
.WithResponseType(AuthorizationResponseType.Code)
.WithConnection("Username-Password-Authentication")
.WithRedirectUrl("https://localhost:5001/home/callback")
.WithScope("openid offline_access")
.WithState("1234567890")
.Build()
.ToString();
return Redirect(authUrl);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.