Rocket.Chat.Android icon indicating copy to clipboard operation
Rocket.Chat.Android copied to clipboard

Error: disallowed_useragent

Open el-psycho opened this issue 9 years ago • 9 comments

Your Rocket.Chat.Android version: develop branch (commit c68d0a6651ef8d224c4c7ce188caed81dcaa1835)

Getting this error when trying to login using Google Auth to our own rocketchat server version 0.53.0

More information about the error is here: https://developers.googleblog.com/2016/08/modernizing-oauth-interactions-in-native-apps.html

el-psycho avatar Mar 30 '17 23:03 el-psycho

I'm​ believe this was fixed by rocket.chat server 0.54.2

geekgonecrazy avatar Mar 31 '17 04:03 geekgonecrazy

Have upgraded Rocket.Chat server to 0.54.2, issue with Oauth still unfortunately persists.

brynn-macpherson avatar Mar 31 '17 17:03 brynn-macpherson

Yeah, same error on the Android app after upgrading the rocketchat server to 0.54.2

el-psycho avatar Mar 31 '17 21:03 el-psycho

@RocketChat/android i leave it to you. :grin: I know the ios project had an issue with authentication. I don't know if the same or not.

https://github.com/RocketChat/Rocket.Chat.iOS/issues/350

geekgonecrazy avatar Mar 31 '17 21:03 geekgonecrazy

Setting the webview's user agent to "Chrome/56.0.0.0 Mobile" fixes this for me:

diff --git a/app/src/main/java/chat/rocket/android/fragment/oauth/AbstractOAuthFragment.java b/app/src/main/java/chat/rocket/android/fragment/oauth/AbstractOAuthFragment.java
index 0c1efb5..da1a841 100644
--- a/app/src/main/java/chat/rocket/android/fragment/oauth/AbstractOAuthFragment.java
+++ b/app/src/main/java/chat/rocket/android/fragment/oauth/AbstractOAuthFragment.java
@@ -127,6 +127,7 @@ public abstract class AbstractOAuthFragment extends AbstractWebViewFragment
     }
 
     resultOK = false;
+    webView.getSettings().setUserAgentString("Chrome/56.0.0.0 Mobile");
     webView.loadUrl(url);
     webView.addJavascriptInterface(new JSInterface(result -> {
       // onPageFinish is called twice... Should ignore latter one.

I realize this is not a true fix since this should probably be done using a Chrome Custom Tab or something like that, but could this temporary fix be implemented and released to the play store? Our users can't authenticate using the G button with the current version on the play store.

el-psycho avatar Apr 03 '17 05:04 el-psycho

@laggedHero :top:

@el-psycho can you open a PR with those changes? Fastest way to get the ball moving

geekgonecrazy avatar Apr 03 '17 05:04 geekgonecrazy

PR created.

el-psycho avatar Apr 03 '17 16:04 el-psycho

Hey guys, just wondering a ballbark estimate when we can expect to see this temp fix in a release on the Play store. Thanks.

el-psycho avatar Apr 04 '17 20:04 el-psycho

Probably this week. I'm trying to round up autocomplete for users and channels to the same build.

laggedHero avatar Apr 04 '17 21:04 laggedHero