private void SetupTwitchAPI() { _ApiSettings = new ApiSettings { ClientId = Constants.ApplicationNameFormatted, AccessToken = SettingsManager.Configuration.Notifications.TwitchToken.Replace("oauth:", "") }; _TwitchAPI = new TwitchAPI(settings: _ApiSettings); UserAuthed userAuthed = _TwitchAPI.V5.Users.GetUserAsync().Result; AuthorizedUser = new AuthorizedUser(userAuthed.Id, userAuthed.DisplayName, userAuthed.Logo); }
private async void OnAuthorized(object sender, AuthorizedEventArgs e) { this.accessToken = e.AccessToken; this.refreshToken = e.RefreshToken; api.Settings.ClientId = clientId; api.Settings.AccessToken = accessToken; Debug.Log("Authorized. Getting user info..."); UserAuthed userAuthed = await api.V5.Users.GetUserAsync(); Debug.Log(userAuthed.Name); username = userAuthed.Name; InitializeTwitchApi(); }