ASP.NET Monsters #26: GitHub Authentication in ASP.NET Core

Play ASP.NET Monsters #26: GitHub Authentication in ASP.NET Core


When your primary market is fellow developers, having GitHub authentication is a great way to allow your users to engage with your site without requiring them to sign up on yours, while still providing a means to create and manage user-specific data in your application.

In this episode, Monster James walks us through the process of getting GitHub authentication working in an ASP.NET Core application using the OAuth authentication provider. 



Right click to download this episode

The Discussion

  • User profile image

    I see you mentioned that you cannot specify custom scopes using the OAuthOptions.  However, looking at the definition of Scope, it is defined as ICollection<string>.  This class has a method defined as Add(string item), which you can use to add scopes to the options.  This means, once you have created your OAuthOptions object, you can simply use options.Scopes.Add(scope1), options.Scopes.Add(scope2), etc.  You can even wrap this in an extension method, along the lines:

    public OAuthOptions WithScopes(this OAuthOptions options, params string[] scopes) {
    foreach(var scope in scopes) {

    Or, if you prefer to fully use object initializers, you can still use a collection initializer without specifying the new portion, i.e.:

    new OAuthOptions() {
    ClientId = GetClientId(),
    ClientSecret = GetClientSecret(),
    // Set other important properties here
    Scopes = {

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.