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

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

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.