Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After Successfull google authorisation(GTMAppAuth) sometimes google.co.in page is loading #45

Open
MIOSY opened this issue Aug 11, 2017 · 0 comments

Comments

@MIOSY
Copy link

MIOSY commented Aug 11, 2017

I have done successfull google authentication with google GTMAppAuth library. Here user can able to login but sometimes not in everytime google.co.in search page is loading. I made authoration with the below code. once user enters into his username and password it should ask allow access to the user after it will come back to the application. The problem is loading google search page on sometimes.

func startgetauth(){

//need this potatoe
let issuer = URL(string: kIssuer)!
let redirectURI = URL(string: kRedirectURI)!

    // discovers endpoints
    OIDAuthorizationService.discoverConfiguration(forIssuer: issuer, completion: {(_ configuration: OIDServiceConfiguration?, _ error: Error?) -> Void in
        if configuration == nil {

            return
        }

        // builds authentication request
        let scopes = [OIDScopeOpenID, OIDScopeProfile, OIDScopeEmail, "https://mail.google.com/", OIDScopeAddress, OIDScopePhone ]

        let request = OIDAuthorizationRequest(configuration: configuration!, clientId: self.kClientID, clientSecret:nil, scopes: scopes, redirectURL: redirectURI, responseType: OIDResponseTypeCode, additionalParameters: nil)
        
        // performs authentication request

        self.appDelegate.currentAuthorizationFlow = OIDAuthState.authState(byPresenting: request, presenting: self, callback: {(_ authState: OIDAuthState?, _ error: Error?) -> Void in
            if authState != nil {
                print("access Token :\(String(describing: authState!.lastTokenResponse!.accessToken!))")
                self.auth = GTMAppAuthFetcherAuthorization(authState: authState!)
                print("Authorisation \(self.auth!)")
                self.doneFetchingAuth(self.auth!)
                GTMAppAuthFetcherAuthorization.save(self.auth!, toKeychainForName: self.keyChainForAccount)
                print("SAVED KEYCHAIN DETAILKS: \(self.keyChainForAccount)")
                
           //     GTMAppAuthFetcherAuthorization.auth.redirectURI = "http://localhost//mailDoughFull"
                		#if FREE
               // 				GTMAppAuthFetcherAuthorization.auth.redirectURI = "http://localhost//mailCleanerFree"
                			#endif
            }
            else {
                print("Authorization error: " + (error?.localizedDescription.description)!)

            }
        })
    })
    
    		oauthViewControllerShown = true

}
BUG Video.zip

@WilliamDenniss @dberlin @willnorris @wkiefer @cdibona

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant