I'm trying to implement AWS Mobile Hub in iOS. I see my Identity ID on Identity Browser when clicked "Sign in with Google" button. There is not problem here. Then I want to access GIDGoogleUser. I initialized GIDGoogleUser but I cannot access user info :
let googleUser = GIDGoogleUser.init()
Then I checked is user logged in with google :
if(AWSGoogleSignInProvider.init().isLoggedIn){
print("Success")
}else{
print("Authentication error")
}
I see 'authentication error' output in xcode. Where is my mistake ? And how can I get google user's email and full name ?
AppDelegate.swift :
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
AWSGoogleSignInProvider.sharedInstance().setScopes(["profile","email", "openid"])
AWSSignInManager.sharedInstance().register(
signInProvider: AWSGoogleSignInProvider.sharedInstance())
let didFinishLaunching = AWSSignInManager.sharedInstance().interceptApplication(
application, didFinishLaunchingWithOptions: launchOptions)
if (!isInitialized) {
AWSSignInManager.sharedInstance().resumeSession(completionHandler: {
(result: Any?, error: Error?) in
print("Result: \(result) \n Error:\(error)")
})
isInitialized = true
}
return didFinishLaunching
}