public SpreadSheetManager()
        {
            if (config == null)
            {
                config = (GoogleSheetsToUnityConfig)UnityEngine.Resources.Load("GSTU_Config");
            }

            ServicePointManager.ServerCertificateValidationCallback = Validator;
            OAuth2 oAuth2       = new OAuth2();
            var    refreshToken = config.REFRESH_TOKEN;

            new SpreadSheetManager(oAuth2.GetOAuth2Parameter(refreshToken));
        }
Пример #2
0
        public OAuth2Parameters GetOAuth2Parameter(string refreshToken)
        {
            if (config == null)
            {
                config = (GoogleSheetsToUnityConfig)UnityEngine.Resources.Load("GSTU_Config");
            }

            OAuth2Parameters parameters = new OAuth2Parameters();

            parameters.ClientId     = config.CLIENT_ID;
            parameters.ClientSecret = config.CLIENT_SECRET;
            parameters.RefreshToken = refreshToken;
            OAuthUtil.RefreshAccessToken(parameters);
            return(parameters);
        }
Пример #3
0
        public string GetAuthURL()
        {
            if (config == null)
            {
                config = (GoogleSheetsToUnityConfig)UnityEngine.Resources.Load("GSTU_Config");
            }

            OAuth2Parameters parameters = new OAuth2Parameters();

            parameters.ClientId     = config.CLIENT_ID;
            parameters.ClientSecret = config.CLIENT_SECRET;
            parameters.RedirectUri  = REDIRECT_URI;
            parameters.Scope        = SCOPE;
            return(OAuthUtil.CreateOAuth2AuthorizationUrl(parameters));
        }
Пример #4
0
        public string AuthWithAccessCode(string accessCode)
        {
            if (config == null)
            {
                config = (GoogleSheetsToUnityConfig)UnityEngine.Resources.Load("GSTU_Config");
            }

            OAuth2Parameters parameters = new OAuth2Parameters();

            parameters.ClientId     = config.CLIENT_ID;
            parameters.ClientSecret = config.CLIENT_SECRET;
            parameters.RedirectUri  = REDIRECT_URI;
            parameters.Scope        = SCOPE;
            parameters.AccessCode   = accessCode;

            OAuthUtil.GetAccessToken(parameters);
            return(parameters.RefreshToken);
        }