Skip to content

Instantly share code, notes, and snippets.

@xximjasonxx
Last active July 20, 2020 00:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xximjasonxx/bdaf3834bbf51b9f9d494ff79aedee04 to your computer and use it in GitHub Desktop.
Save xximjasonxx/bdaf3834bbf51b9f9d494ff79aedee04 to your computer and use it in GitHub Desktop.
[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