google / google/GTMAppAuth

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

Open
#45 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
448
Forks
247
Avg merge
2d 8h
Merged PRs (30d)
5

Description

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](https://github.com/google/GTMAppAuth/files/1217686/BUG.Video.zip)

# @WilliamDenniss @dberlin @willnorris @wkiefer @cdibona

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.