[Update #2] Changed Enums.x.y to Scope.x.y; and moved it to the Enums namespace. I should probably have waited writing this post until done making changes for the day.
[Update]
Went ahead and changed the scopes to Enums. Everything else is the same but looks a bit more cleaner than previously.
[Original]
Updated BlushyFace.Twitch.Authentication to include scopes based on github.com/BarryCarlyon/twitch_misc/blob/master/authentication/user_access_generator/scopes.json by Barry Carlyon. This should make it more clear when adding (multiple) scopes instead of writing them manually which can be prone to errors.
Before
OAuth.OpenBrowserImplicitFlow(scopes: "chat:edit+chat:read+whispers:edit+user:read:email"); OAuth.OpenBrowserAuthorizationFlow(scopes: "user:read:email");
After
var scopes = new Scopes(); scopes.Helix.AddAnalyticsReadExtensions(); scopes.Helix.AddBitsRead(); scopes.Helix.AddModerationRead(); scopes.Drops.AddViewingActivityRead(); scopes.Chat.AddChatEdit(); scopes.Chat.AddChatRead(); scopes.Chat.AddWhispersEdit(); scopes.Chat.AddWhispersRead(); // opens the browser using the implicit flow with specified scopes OAuth.OpenBrowserImplicitFlow(scopes: scopes); // we don't want the current scopes so clear it before adding scopes.ClearScopes(); scopes.Kraken.AddChannelSubscriptions(); scopes.Kraken.AddChannelCommercial(); scopes.Kraken.AddUserFollowsEdit(); // opens the browser using the authorization flow with specified scopes OAuth.OpenBrowserAuthorizationFlow(scopes: scopes); scopes.Kraken.AddChannelSubscriptions(); scopes.Kraken.AddChannelCommercial(); scopes.Kraken.AddUserFollowsEdit(); // open the browser using the authorization flow with specified scopes OAuth.OpenBrowserAuthorizationFlow(scopes: scopes); scopes.ClearScopes(); // adding same scopes (by accident) will be ignored scopes.Chat.AddChatRead(); scopes.Chat.AddChatRead(); scopes.Chat.AddChatEdit(); OAuth.OpenBrowserAuthorizationFlow(scopes: scopes);
That said, an alternative way to do this would be using Enums. I could change it again since I’ve already written partial support for it but either way it would look like something like this:
If you think it’s cleaner than how i’ve done it currently let me know so i can change it again (I personally think it’s cleaner but thought about it halfway..)