Titanium JIRA Archive
Appcelerator Community (AC)

[AC-4955] Webview Google OAuth Issue

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionNot Our Bug
Resolution Date2017-05-10T11:22:09.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsn/a
ReporterJATIN JOSHI
AssigneeShak Hossain
Created2017-05-09T23:55:49.000+0000
Updated2017-05-10T13:28:28.000+0000

Description

I am using the OAuth feature of Google to authenticate users. Authorization page opens with a 403 error with the description: This user-agent is not permitted to make OAuth authorization request to Google as it is classified as an embedded user-agent (also known as a web-view). Per our policy, only browsers are permitted to make authorization requests to Google. We offer several libraries and samples for native apps to perform authorization request in browser. Google url is opened within web view. Code Snippet: $.webview.url = args.url;//for new oAuth function webviewLoaded(e){ //wait for result to be put on webview by backend: var result = $.webview.evalJS('result'); console.log("Social Login Results ---" + result); //when get the result, call the return function in index.js and return the result: if(result){ args.loginReturned(result); $.socialLogin.close(); } }

Attachments

FileDateSize
GoogleErrorWEbView.png2017-05-09T23:54:51.000+0000209301

Comments

  1. Hans Knöchel 2017-05-10

    Here are your options (this is no Titanium issue): - Use the [Ti.GoogleSignIn](https://github.com/hansemannn/titanium-google-signin) module to do the OAuth flow with their native library - Use the Safari-Browser via Ti.Platform.openURL to handle the URL and set the callback url-scheme to your app's URL scheme (e.g. myapp:// WebViews in general are disallowed by Google, that's what the message also says. I hope one of the above suggestions will help.
  2. JATIN JOSHI 2017-05-10

    I tried this: safariDialog.open({ url: args.url, tintColor:"red" }); Ti.App.iOS.addEventListener("handleurl", function(e) { // If the handled url is provided by the safari-dialog, close it (use-case for OAuth) console.log("RESPONSE FROM SERVER" + JSON.stringify(e)); if (e.launchOptions.source == "com.apple.SafariViewService") { safari.close(); } }); But not getting any response.

JSON Source