Created
April 28, 2016 19:15
-
-
Save nemesv/3ac06ff08dc454dd3f7240fac936051b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", | |
Scope = { "user", "repo" }, | |
SaveTokensAsClaims = true, | |
// Retrieving user information is unique to each provider. | |
Events = new OAuthEvents | |
{ | |
OnCreatingTicket = async context => { await CreatingGitHubAuthTicket(context); } | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private OAuthOptions GitHubOptions | |
{ | |
get | |
{ | |
var 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 CreatingGitHubAuthTicket(context); } | |
} | |
}; | |
gitHubOptions.Scope.Add("user"); | |
gitHubOptions.Scope.Add("repo"); | |
return gitHubOptions; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment