Beispiel #1
0
        // Tokens
        public static async Task <RestTokenInfo> GetTokenInfoAsync(BaseTwitchClient client, RequestOptions options = null)
        {
            var model = await client.ApiClient.ValidateTokenAsync(options).ConfigureAwait(false);

            if (model.Token != null)
            {
                return(RestTokenInfo.Create(client.ApiClient.AuthToken, model.Token));
            }
            return(null);
        }
Beispiel #2
0
        public static async Task <RestTokenInfo> AuthorizeAsync(BaseRestClient client, string token)
        {
            await client.Logger.InfoAsync("Rest", "Logging in...").ConfigureAwait(false);

            var model = await client.RestClient.AuthorizeAsync(token);

            var entity = RestTokenInfo.Create(model, token);

            await client.Logger.InfoAsync("Rest", "Login success!").ConfigureAwait(false);

            return(entity);
        }