Beispiel #1
0
        private async Task <bool> AutoLog()
        {
            // We should prefer getting a new token

            // Verify we got a client_id and a client_secret
            if (!string.IsNullOrEmpty(FORGE_CLIENT_ID) &&
                !string.IsNullOrEmpty(FORGE_CLIENT_SECRET)
                )
            {
                /*dynamic bearer =*/ await oauthExecAsync();

                if (!string.IsNullOrEmpty(_2LEGGED))
                {
                    return(true);
                }
            }

            // Verify this token is still valid
            if (!string.IsNullOrEmpty(_2LEGGED))
            {
                try {
                    DerivativesApi md = new DerivativesApi();
                    md.Configuration.AccessToken = accessToken;
                    dynamic response = await md.GetFormatsAsync();

                    return(true);
                } catch (Exception ex) {
                    _2LEGGED = "";
                }
            }

            //MessageBox.Show ("No auto-log...", APP_NAME, MessageBoxButton.OK, MessageBoxImage.Information) ;
            return(false);
        }