Open kolodiichyk opened 7 years ago
p.s. Error is thrown after set new ClientId (generated in console.developers.google.com)
I face the same issue as @koland face, If I am trying to create new clientId and try to use it then it shows "disallowed_useragent".
Also as I run the sample project, It open the URL in web view, but also there it shows a warning like below
"Notice for developers : authorization requests in embedded browsers will be blocked on April 20, 2017"
From above this, do we need to open the URL in SAFARI for OAuth Validation now on ?
Put the following code into FinishedLaunching on your AppDelegate.cs (before global::Xamarin.Forms.Forms.Init()):
`// define useragent android like string userAgent = "Mozilla/5.0 (Linux; Android 5.1.1; Nexus 5 Build/LMY48B; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/43.0.2357.65 Mobile Safari/537.36";
// set default useragent NSDictionary dictionary = NSDictionary.FromObjectAndKey(NSObject.FromObject(userAgent), NSObject.FromObject("UserAgent")); NSUserDefaults.StandardUserDefaults.RegisterDefaults(dictionary);`
We tried @sgou solution and we are still getting a 403 error.
Anybody fix this issues. Kindly share with me... i have face same like this issues in google calendar used in swift (IOS)
After wasting couple of hours in implementing and coming across this error with a new project I created in google console
and using that client_id
, I checked with one of my older project's client_id
and it worked.
So as @koland said I agree that smart google has noticed this behavior and stopping the support to get access token from WebView
at least stopped for the new client_ids generated and still working with the old ones may be giving developers time to migrate.
Now I want to see the same application after 20th April. and need to verify @sgou 's solution for iOS
I am more concerned about is PhoneGap
and Ionic
applications
I am also facing same issue with Google login. Please share solution if anybody have already.
I recently faced the issue. I tried @sgou 's solution but it did not work though I got the reference 👍 . And following code resolved the issue: in AppDelegate;
// Register browser to avoid '403 Error: disallowed_useragent' error in Google sign in
let dict = NSDictionary(object: "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36", forKey: "UserAgent" as NSCopying)
UserDefaults.standard.register(defaults: dict as! [String : Any])
After google policy update - iOS example not works - error 403 - disallowed_useragent
"This user-agent is not permitted to make an OAuth authorization request to Google as it is classified as an embedded user-agent (also known as a web-view). Per our policy, only browser are permitted to make authorization requests to Google. We offer several libraries and samples for native apps to perform authorization request in the browser."