public AuthenticationResult(QueryValues values) { this.AccessToken = values.Single("access_token"); this.RefreshToken = values.Single("refresh_token"); this.ExpiresIn = NumberUtils.ToInt(values.Single("expires_in")); this.Scopes = values.Single("scope").Split(OAuthRequest.ScopeSeparater, StringSplitOptions.RemoveEmptyEntries); this.TokenType = values.Single("token_type"); }
public void EnsureStateEquals(QueryValues queryValues, OAuthRequestCode request) { var requested = request.State; if (requested == null) { return; } var responsed = queryValues.Single("state"); if (requested.Equals(responsed) == false) { throw new TwitchException($"OAuth state mismatched - Request:{requested} vs Response:{responsed})"); } }