Open kushaldexati opened 2 years ago
This just started happening to me too. It was working fine in January, and little if anything changed, and now this error on this line: let postal = Postal(configuration: .gmail(login: login, password: .accessToken(accessToken)))
Able to get accessToken just fine. Tried different IMAP account. Tried previous working commits. Tried different Google app registration. Tried different Apple cert. Nothing worked.
In my case, the root cause was something changing on my google cert side, and the gmail api scope wasn't part of that google cert anymore. Once the gmail api scope was added back, it worked. Adding the scope via google console web UI never made a difference. Only worked through their api client for changing scope:
func ensureGoogleScope(user: GIDGoogleUser?) {
let gmailScope = "https://mail.google.com/"
let grantedScopes = user?.grantedScopes
if grantedScopes == nil || !grantedScopes!.contains(gmailScope) {
// Request additional Drive scope.
let additionalScopes = [gmailScope]
GIDSignIn.sharedInstance.addScopes(additionalScopes, presenting: getRootViewController()) { user, error in
guard error == nil else { return }
guard let user = user else { return }
// Check if the user granted access to the scopes you requested.
print("granted scopes: \(String(describing: user.grantedScopes))")
}
}
}
Suggestion for Postal: Show the complete error text from google. That would have indicated the exact cause of "Authentication Failed", such as not having the correct scope, or whatever the issue is.
when I try to log in it is showing error: login(description: "Authentication Failed")
currently trying to login with iCloud