示例#1
0
 public void DynamicScopeValidation(Enums.AuthScopes requiredScope, string accessToken = null)
 {
     if (!Validators.SkipDynamicScopeValidation && accessToken == null)
     {
         if (!Scopes.Contains(requiredScope) || (requiredScope == Enums.AuthScopes.Any && Scopes.Count == 0))
         {
             throw new InvalidCredentialException($"The current access token ({Scopes.ToString()}) does not support this call. Missing required scope: {requiredScope.ToString().ToLower()}. You can skip this check by using: TwitchLib.TwitchAPI.Settings.Validators.SkipDynamicScopeValidation = true . You can also generate a new token with this scope here: https://twitchtokengenerator.com");
         }
     }
 }
示例#2
0
 public void ValidateScope(Enums.AuthScopes requiredScope, string accessToken = null)
 {
     if (accessToken != null)
     {
         return;
     }
     if (Scopes.Contains(requiredScope))
     {
         throw new Exceptions.API.InvalidCredentialException($"The call you attempted was blocked because you are missing required scope: {requiredScope.ToString().ToLower()}. You can ignore this protection by using TwitchLib.TwitchAPI.Settings.Validators.SkipDynamicScopeValidation = false . You can also generate a new token with the required scope here: https://twitchtokengenerator.com");
     }
 }