You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@roshangm1 added the solution but its not merged yet. For the moment just modify the file in node_modules: node_modules/react-native-oauth/android/src/main/java/io/fullstack/oauth/OAuthManagerDialogFragment.java:
...
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setDomStorageEnabled(true);
// add this line (112)
mWebView.getSettings().setUserAgentString("Mozilla/5.0 (Linux; Android 4.1.1; Galaxy Nexus Build/JRO03C) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19");
...
Reacted by David Axelrod, Kamronbek_Juraev, Rasika Vilankar and praveenbalaji19
@roshangm1 added the solution but its not merged yet. For the moment just modify the file in node_modules: node_modules/react-native-oauth/android/src/main/java/io/fullstack/oauth/OAuthManagerDialogFragment.java:
...
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setDomStorageEnabled(true);
// add this line (112)
mWebView.getSettings().setUserAgentString("Mozilla/5.0 (Linux; Android 4.1.1; Galaxy Nexus Build/JRO03C) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19");
...
The above fix actually generates another issue. If you get a notification from google it will say that you have logged in from a Nexus device due to the user agent string Galaxy Nexus...
@roshangm1 added the solution but its not merged yet. For the moment just modify the file in node_modules: node_modules/react-native-oauth/android/src/main/java/io/fullstack/oauth/OAuthManagerDialogFragment.java:
...
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setDomStorageEnabled(true);
// add this line (112)
mWebView.getSettings().setUserAgentString("Mozilla/5.0 (Linux; Android 4.1.1; Galaxy Nexus Build/JRO03C) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19");
...
The above fix actually generates another issue. If you get a notification from google it will say that you have logged in from a Nexus device due to the user agent string Galaxy Nexus...
Hopefully there will be another fix
A quick and dirty fix for you is just simply remove the Galaxy Nexus... from the User-Agent string you set
or you can use mWebView.getSettings().setUserAgentString(mWebView.getSettings().getUserAgentString()) to get the real UserAgent and set it back to the webview
update on 12 Apr 2021:
you can remove wv from the UserAgent mWebView.getSettings().setUserAgentString(mWebView.getSettings().getUserAgentString().replace("; wv", ""));
P.S. I have open the PR for this issue, however this library seems no longer supported by the original author, you may consider using other OAuth RN library.
I encountered this issue in Android (and not react). I first started with the solution
web_view.settings.userAgentString = "Mozilla/5.0 (Linux; Android 4.1.1; Galaxy Nexus Build/JRO03C) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19"
it worked. However, if the user is not logged in, Google asks the user to login and when they ask the user to verify the login, sometimes on an already logged in device and they report incorrect device details.
Eg: On using the above example I was said I tried logging in on an Android 4 device, even when I was on an Android 9 device. This could be confusing to users.
So I tried seeing what's the default value in web_view.settings.userAgentString and found the value to be
Mozilla/5.0 (Linux; Android 9; vivo 1904 Build/PPR1.180610.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/89.0.4389.90 Mobile Safari/537.36
I realised the problem is wv in the above string, so I just removed that and it worked fine.
Activity
maggialejandro commentedon Mar 19, 2017
I started a project from scratch and I'm having the same issue.
auser commentedon Mar 19, 2017
I'll check later today... see if I can't figure out what's happening
SobolRR commentedon Apr 4, 2017
Any updates?
timbielawski commentedon Apr 5, 2017
You can use this fork until the PR gets merged in
https://github.com/timbielawski/react-native-oauth
vanydeasy commentedon Apr 30, 2017
I'm still having the same issue.
react-native: 0.42.0
react-native-oauth: 2.1.16
Jazz747 commentedon Jun 30, 2017
Same, even after updating changes that @timbielawski made.
react-native 45.1
react-native-oauth 2.1.16
DmitryMaksakov commentedon Jul 4, 2017
The same:
react-native: 0.45.1,
react-native-oauth: 2.1.16
roshangm1 commentedon Jul 7, 2017
The changes of @timbielawski works perfectly. Don't forget to clean the project after making those changes.
HarshankArastu commentedon Feb 22, 2018
Any update on this issue?
roshangm1 commentedon Feb 22, 2018
@HarshankArastu Try this fork which might fix this bug.
https://github.com/roshangm1/react-native-oauth
egiesem commentedon Jun 18, 2018
solved
https://www.youtube.com/watch?v=vFSgIdtEl2k
marcioferlan commentedon Sep 27, 2018
It solved the issue for me. When will this be merged?
krisidmisso commentedon Apr 15, 2019
@roshangm1 added the solution but its not merged yet. For the moment just modify the file in node_modules:
node_modules/react-native-oauth/android/src/main/java/io/fullstack/oauth/OAuthManagerDialogFragment.java:daxaxelrod commentedon May 17, 2019
@krisidmisso your solution worked for me. Looks like it'll be merged into the repo soon
krisidmisso commentedon Sep 24, 2019
The above fix actually generates another issue. If you get a notification from google it will say that you have logged in from a Nexus device due to the user agent string
Galaxy Nexus...Hopefully there will be another fix
ericchan3721 commentedon Jul 22, 2020
A quick and dirty fix for you is just simply remove the
Galaxy Nexus...from the User-Agent string you setor you can use
mWebView.getSettings().setUserAgentString(mWebView.getSettings().getUserAgentString())to get the real UserAgent and set it back to the webviewupdate on 12 Apr 2021:
you can remove
wvfrom the UserAgentmWebView.getSettings().setUserAgentString(mWebView.getSettings().getUserAgentString().replace("; wv", ""));Ref: https://developers.googleblog.com/2016/08/modernizing-oauth-interactions-in-native-apps.html
P.S. I have open the PR for this issue, however this library seems no longer supported by the original author, you may consider using other OAuth RN library.
vaibhavgadekar commentedon Dec 10, 2020
Simple add userAgent={"chrome"}
It's works for me 🤘
saran2020 commentedon Mar 17, 2021
I encountered this issue in Android (and not react). I first started with the solution
it worked. However, if the user is not logged in, Google asks the user to login and when they ask the user to verify the login, sometimes on an already logged in device and they report incorrect device details.
Eg: On using the above example I was said I tried logging in on an Android 4 device, even when I was on an Android 9 device. This could be confusing to users.
So I tried seeing what's the default value in
web_view.settings.userAgentStringand found the value to beI realised the problem is
wvin the above string, so I just removed that and it worked fine.My end code looked something like this