Google plus returns "Error: disallowed_useragent" when opening OAuth page in BrowserComponent / WebBrowser

183 views
Skip to first unread message

mispro...@gmail.com

unread,
Jul 4, 2017, 4:26:31 AM7/4/17
to CodenameOne Discussions
I was trying to perform OAuth 2 with Google plus but it returns the 403 page, "Error: disallowed_useragent" when opening the page with BrowserComponent.
It works before, and so it seems that Google has changed the policies.

I have also used the Oauth2.showAuthentication for testing, but it keeps loading forever.
It works with simulator however.

As we cannot customize the User-agent of BrowserComponent, what we should do to overcome this problem?
Thanks.

Jensan

mispro...@gmail.com

unread,
Jul 4, 2017, 10:14:46 PM7/4/17
to CodenameOne Discussions
FYI, I have removed all unnecessary components and try to the Oauth2.showAuthentication again. It now loads the same error page - disallowed_useragent.
Thanks.

Shai Almog

unread,
Jul 5, 2017, 12:15:40 AM7/5/17
to CodenameOne Discussions, mispro...@gmail.com
Why are you using this approach and not the native login?

mispro...@gmail.com

unread,
Jul 5, 2017, 2:02:35 AM7/5/17
to CodenameOne Discussions, mispro...@gmail.com
Do you mean the one in GoogleConnect?

The isNativeLoginSupported method always returns false, doesn't it?

Shai Almog

unread,
Jul 6, 2017, 1:01:14 AM7/6/17
to CodenameOne Discussions, mispro...@gmail.com
Yes.
It should work on the device if you included the build hints as explained in the developer guide.

mispro...@gmail.com

unread,
Jul 6, 2017, 3:47:11 AM7/6/17
to CodenameOne Discussions
Thanks for the answer.
Now I have tried to run it on iOS. It fails and gives the error message "Please install the Google Plus app on your device in order to log in with Google Plus".
What does it mean?

Build Hint

ios.gplus.clientId=xxxxxxxxxxxxxc6.apps.googleusercontent.com (copied from credential type ios)

Code

Login gc = GoogleConnect.getInstance();
gc
.setClientId("xxxxxxxxxxxxgk0.apps.googleusercontent.com"); // client ID copied from the credential type Web application
gc
.setRedirectURI(...);
gc
.setClientSecret(...);
gc
.setCallback(...);
gc
.doLogin();

Is there anything wrong? Thanks.

Shai Almog

unread,
Jul 7, 2017, 1:09:53 AM7/7/17
to CodenameOne Discussions, mispro...@gmail.com
It needs a Google app in order to perform the native login using that app. The way native login works is that it spans the official Google application which authorizes the user and then returns a "token" to your app.

mispro...@gmail.com

unread,
Jul 7, 2017, 2:01:48 AM7/7/17
to CodenameOne Discussions, mispro...@gmail.com
In the same device, I have installed Google Search, Google Chrome, Google Drive, Google Map, Gmail already.
All of these apps do not need to re-enter the login information once installed.
So I have no idea what's going on.

Shai Almog

unread,
Jul 8, 2017, 1:51:13 AM7/8/17
to CodenameOne Discussions, mispro...@gmail.com
Are you sure you set the build hint correctly via the settings app?
You didn't edit the codenameone_settings.properties app directly right?

mispro...@gmail.com

unread,
Jul 9, 2017, 9:52:36 PM7/9/17
to CodenameOne Discussions, mispro...@gmail.com
To ensure it has been applied correctly, I have removed the existing build hint and re-applied the Client ID by clicking Codename One Preference -> Build Hints -> Add Hint "ios.gplus.clientId" -> Save

Open the console.devepers.google.com and access the Credential part



Checked that the build hint is correct.
Checked the Bundle ID and it matches with the build hint codename1.ios.appid. Also tried the values xxxxxxxxx.com.xxxxxxx.xxxxx and com.xxxxxxx.xxxxx, but both return the same error.

Any more suggestion? Thanks.

Shai Almog

unread,
Jul 10, 2017, 1:24:13 AM7/10/17
to CodenameOne Discussions, mispro...@gmail.com
I haven't done this in a while but Steve fixed a bug in google+ login just last week so this might be fresher in his memory. I'll ask him to look.

Steve Hannah

unread,
Jul 10, 2017, 1:03:33 PM7/10/17
to codenameone...@googlegroups.com, mispro...@gmail.com
Apple started rejecting apps that use Safari to handle login.  Therefore you need to have the Google Plus app installed for google login to work.  You can relax this restriction using the
ios.gplus.requireGplusAppForLogin=false

build hint - but that's probably not a good idea.

Steve

On Sun, Jul 9, 2017 at 10:24 PM, Shai Almog <shai....@gmail.com> wrote:
I haven't done this in a while but Steve fixed a bug in google+ login just last week so this might be fresher in his memory. I'll ask him to look.

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsub...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/9c0d57d7-8926-4163-ac91-a9f89f3b65d4%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Steve Hannah
Software Developer
Codename One

mispro...@gmail.com

unread,
Jul 11, 2017, 6:40:38 AM7/11/17
to CodenameOne Discussions
Thanks Steve.

I have installed the Google+ app and logged in. Google+ app:
However I still get the "Please install the Google Plus app on your device...." error message in my app.

So I have tried to add the ios.gplus.requireGplusAppForLogin=false build hint and re-built
Still the same error message...

Steve Hannah

unread,
Jul 11, 2017, 11:46:54 AM7/11/17
to codenameone...@googlegroups.com

So I have tried to add the ios.gplus.requireGplusAppForLogin=false build hint and re-built


Sorry.  My mistake.  It's a display property, not a build hint.  So:

Display.getInstance().setProperty("ios.gplus.requireGplusAppForLogin", "false");

I'm looking into the other issue (the fact that the error message still appears with the GooglePlus app installed on your device).

Steve

mispro...@gmail.com

unread,
Jul 12, 2017, 5:52:31 AM7/12/17
to CodenameOne Discussions
After adding the property, it works, at least for now, with safari opened and logged in
Just the Login.getAccessToekn().getExpires() returns null. Can be ignored first. Thanks.

Shai Almog

unread,
Jul 13, 2017, 12:27:26 AM7/13/17
to CodenameOne Discussions, mispro...@gmail.com
It seems there are issues with Google plus. We will be replacing it with standard Google login in the next update.

mispro...@gmail.com

unread,
Jul 13, 2017, 3:29:33 AM7/13/17
to CodenameOne Discussions, mispro...@gmail.com
Thanks Shai.
If possible please post an update to the Google Login tutorial.

Shai Almog

unread,
Jul 14, 2017, 12:37:47 AM7/14/17
to CodenameOne Discussions, mispro...@gmail.com
This is what Steve wrote for now:

Go to https://developers.google.com/mobile/add, follow the steps to create an App, and enable Google Sign-In, and download the GoogleService-Info.plist file.  Then copy this file into your project's native/ios directory.  No build hints necessary.

Steve is composing a long version with screenshots etc for the developer guide.

mispro...@gmail.com

unread,
Jul 14, 2017, 6:46:59 AM7/14/17
to CodenameOne Discussions, mispro...@gmail.com
Thanks. But is it because of this update, I cannot use the gplus build hint now?

I have received the error when releasing the app:

<main> ERROR: ERROR ITMS-90535: "Unexpected CFBundleExecutable Key. The bundle at 'Payload/MainUI.app/GooglePlus.bundle' does not contain a bundle executable. If this bundle intentionally does not contain an executable, consider removing the CFBundleExecutable key from its Info.plist and using a CFBundlePackageType of BNDL. If this bundle is part of a third-party framework, consider contacting the developer of the framework for an update to address this issue."
<main> DBG-X: The error code is: 1102
<main>  INFO: Done performing authentication.
<main> DBG-X: Returning 1

Steve Hannah

unread,
Jul 14, 2017, 1:06:41 PM7/14/17
to codenameone...@googlegroups.com, Scherring Gmail
If you include the GoogleService-Info.plist in your native/ios directory, it should circumvent the addition of GooglePlus.  Do you have any other build hints explicitly including the GooglePlus framework in your app?  Are you including the GooglePlus bundle in your app in some other way?

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsub...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.

For more options, visit https://groups.google.com/d/optout.

mispro...@gmail.com

unread,
Jul 24, 2017, 1:22:27 AM7/24/17
to CodenameOne Discussions, mispro...@gmail.com
I see.

So we cannot use the ios.gplus.requireGplusAppForLogin build hint anymore.

After the change it works now, though I took another week to re-test the functions...

Thanks.

kyr...@gmail.com

unread,
Jul 26, 2017, 10:27:52 AM7/26/17
to CodenameOne Discussions, mispro...@gmail.com
Hi Steve

Will there be an update that performs the sign-in inside a Web Component within the app. Like the Facebook Login?

Steve Hannah

unread,
Jul 26, 2017, 10:52:31 AM7/26/17
to codenameone...@googlegroups.com, Scherring Gmail
For the simulator, you would use the Oauth2 client ID and secret.  I have documented the full process here:

This will be integrated into the Developer guide soon, but for now you can read it in the Wiki.

Steve

On Wed, Jul 26, 2017 at 7:27 AM, <kyr...@gmail.com> wrote:
Hi Steve

Will there be an update that performs the sign-in inside a Web Component within the app. Like the Facebook Login?

On Monday, July 10, 2017 at 7:03:33 PM UTC+2, Steve Hannah wrote:
Apple started rejecting apps that use Safari to handle login.  Therefore you need to have the Google Plus app installed for google login to work.  You can relax this restriction using the
ios.gplus.requireGplusAppForLogin=false

build hint - but that's probably not a good idea.

Steve
On Sun, Jul 9, 2017 at 10:24 PM, Shai Almog <shai....@gmail.com> wrote:
I haven't done this in a while but Steve fixed a bug in google+ login just last week so this might be fresher in his memory. I'll ask him to look.

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsubscr...@googlegroups.com.



--
Steve Hannah
Software Developer
Codename One

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsub...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.

For more options, visit https://groups.google.com/d/optout.

Shai Almog

unread,
Jul 27, 2017, 1:16:12 AM7/27/17
to CodenameOne Discussions, mispro...@gmail.com
I moved the docs into the developer guide. They should be there now.
Reply all
Reply to author
Forward
0 new messages