public LoopbackAccessTokenProvider(StreamlabsSettings StreamlabsSettings)
        {
            settings         = StreamlabsSettings;
            unitySyncContext = SynchronizationContext.Current;

            accessTokenRefresher         = new AccessTokenRefresher(settings.GenericClientCredentials);
            accessTokenRefresher.OnDone += HandleAccessTokenRefreshed;

            authCodeExchanger         = new AuthCodeExchanger(settings, settings.GenericClientCredentials);
            authCodeExchanger.OnDone += HandleAuthCodeExchanged;
        }
 private void HandleAuthCodeExchanged(AuthCodeExchanger exchanger)
 {
     if (authCodeExchanger.IsError)
     {
         Debug.LogError("UnityStreamlabs: Failed to exchange authorization code.");
         HandleProvideAccessTokenComplete(true);
     }
     else
     {
         settings.CachedAccessToken  = authCodeExchanger.AccesToken;
         settings.CachedRefreshToken = authCodeExchanger.RefreshToken;
         HandleProvideAccessTokenComplete();
     }
 }