Skip to content

Instantly share code, notes, and snippets.

@xximjasonxx
Created July 20, 2020 00:38
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/5ce93c70da24f9a8bb619833c160b09b to your computer and use it in GitHub Desktop.
Save xximjasonxx/5ce93c70da24f9a8bb619833c160b09b to your computer and use it in GitHub Desktop.
[HttpGet]
public async Task<IActionResult> Callback([FromQuery]string code)
{
var authClient = new AuthenticationApiClient("<domain>.auth0.com");
var tokenResponse = await authClient.GetTokenAsync(new AuthorizationCodeTokenRequest
{
RedirectUri = "https://localhost:5001/home/auth_callbabck",
Code = code,
ClientId = "<your client id>",
ClientSecret = "<your client secret>"
});
CustomContext.IdToken = tokenResponse.IdToken;
CustomContext.AccessToken = tokenResponse.AccessToken;
CustomContext.RefreshToken = tokenResponse.RefreshToken;
return Redirect("CodeView");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment