public async Task <GoogleTokenResponse> VerifyAuthCode(GoogleSSORequest ssoRequest)
        {
            string secretKey            = EnvironmentRequester.GetVariable("GoogleSSOClientSecret");
            string redirectUrl          = EnvironmentRequester.GetVariable("BudgeterRedirectUrl");
            string googleRequestedScope = EnvironmentRequester.GetVariable("GoogleRequestedScope");

            GoogleTokenResponse tokenResponse = await GoogleOAuthClient.VerifyCode(ssoRequest, secretKey, redirectUrl, googleRequestedScope);

            VerifyTokenBody(tokenResponse);

            return(tokenResponse);
        }
        public async Task <GoogleTokenResponse> VerifyCode(GoogleSSORequest ssoRequest, string secretKey, string redirectUrl, string googleRequestedScope)
        {
            if (string.IsNullOrEmpty(ssoRequest.AuthorizationCode) || string.IsNullOrEmpty(ssoRequest.ClientId))
            {
                throw new CallerException("Login code and ClientId cannot be null or empty.");
            }

            RestRequester.BaseUrl            = "https://oauth2.googleapis.com";
            RestRequester.RequestContentType = "application/x-www-form-urlencoded";
            string path = $"/token?code={ssoRequest.AuthorizationCode}&redirect_uri={redirectUrl}&client_id={ssoRequest.ClientId}&client_secret={secretKey}&scope={googleRequestedScope}&grant_type=authorization_code";

            return(await RestRequester.MakeRequest <GoogleTokenResponse>(path, HttpMethod.Post, null));
        }
        public async Task <GoogleSSOResponse> Login([FromBody] GoogleSSORequest ssoRequest)
        {
            CheckNullBody(ssoRequest);

            if (string.IsNullOrEmpty(ssoRequest.ClientId) || string.IsNullOrEmpty(ssoRequest.AuthorizationCode))
            {
                throw new CallerException("Google Client Id and Authorization Code are required.");
            }

            GoogleSSOLogic ssoLogic = new GoogleSSOLogic(GoogleOAuthClient, EnvironmentRequester, SettingRequester, Cache, UserContext, AuthContext, BudgeterLock);

            GoogleTokenResponse tokenResponse = await ssoLogic.VerifyAuthCode(ssoRequest);

            return(await ssoLogic.LoginOrRegisterGoogleUser(tokenResponse, IsAdmin));
        }