Skip to content

Instantly share code, notes, and snippets.

@MisterJames
Created April 26, 2016 13:23
Show Gist options
  • Select an option

  • Save MisterJames/746331337329ca50556cbff19a0ba176 to your computer and use it in GitHub Desktop.

Select an option

Save MisterJames/746331337329ca50556cbff19a0ba176 to your computer and use it in GitHub Desktop.
GitHubOptions for Auth in ASP.NET Core
private OAuthOptions GitHubOptions =>
new OAuthOptions
{
AuthenticationScheme = "GitHub",
DisplayName = "GitHub",
ClientId = Configuration["GitHub:ClientId"],
ClientSecret = Configuration["GitHub:ClientSecret"],
CallbackPath = new PathString("/signin-github"),
AuthorizationEndpoint = "https://github.com/login/oauth/authorize",
TokenEndpoint = "https://github.com/login/oauth/access_token",
UserInformationEndpoint = "https://api.github.com/user",
ClaimsIssuer = "OAuth2-Github",
SaveTokensAsClaims = true,
// Retrieving user information is unique to each provider.
Events = new OAuthEvents
{
OnCreatingTicket = async context => { await CreateGitHubAuthTicket(context); }
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment