nativescript-oauth2
nativescript-oauth2 copied to clipboard
Oauth 2 - Google - After Sigin not redirected back to app
Which platform(s) does your issue occur on?
- Android - Angular
- iOS/Android versions
- What type of device - Emulator
Please, provide the following version numbers that your issue occurs with:
- CLI: 7.0.4
- Cross-platform modules: (check the 'version' attribute in the
node_modules/tns-core-modules/package.json
file in your project) - Runtime(s): (look for the
"tns-android"
and"tns-ios"
properties in thepackage.json
file of your project) - Plugin(s): (look for the version numbers in the
package.json
file of your project and paste your dependencies and devDependencies here)
Please, tell us how to recreate the issue in as much detail as possible.
I have integrated the latest version of Oauth -2. After I hit the signin button for Google, it prompt me for login(already loggedin users) on chrome. After I select the login, the browser does not come back to App. It just opens google.com.
I am using exactly same code mentioned in the demo app except the client id and other keys. This used to work for me earlier, it suddenly stopped working. This is working fine on my phone, not working on emulator.
Is there any code involved?
- provide a code example to recreate the problem
- (EVEN BETTER) provide a .zip with application or refer to a repository with application where the problem is reproducible.
@alexziskind1 ..Please help
include this at manifest activity tag
android:launchMode="singleTask"
After Sigin not redirected back to app in IOS
I also get following error, when should be redirected to app:
NativeScript encountered a fatal error: Uncaught TypeError: this.handleIncomingUrl is not a function
at
TnsOAuthClientAppDelegate.applicationOpenURLOptions(file: node_modules/nativescript-oauth2/delegate/index.ios.js:14:0)
Having the same issue - after sign in redirects to google.com
I have exactly the same problem. I have no clue how to fix this... did anybody succeded?
I am still waiting for the resolution
I have exactly the same problem. I have no clue how to fix this... did anybody succeded?
I modified index.ios.js to make it work for now. Replaced this.handleIncomingUrl to TnsOAuthClientAppDelegate.prototype.handleIncomingUrl.
That's great! If that solves the problem then would you like to open a Pull Request?
It works, but this is just a workaround. It's not right to call prototype directly.
That's great! If that solves the problem then would you like to open a Pull Request?
It is a change in js file, generated after build. I don't now what should be changed in source, so can't open a pull request.
I have exactly the same problem. I have no clue how to fix this... did anybody succeded?
I modified index.ios.js to make it work for now. Replaced this.handleIncomingUrl to TnsOAuthClientAppDelegate.prototype.handleIncomingUrl.
Where are this file and this code? i can't find it in my project
I have exactly the same problem. I have no clue how to fix this... did anybody succeded?
I modified index.ios.js to make it work for now. Replaced this.handleIncomingUrl to TnsOAuthClientAppDelegate.prototype.handleIncomingUrl.
Where are this file and this code? i can't find it in my project
At first I modified it directly in node_modules/nativescript-oauth2/delegate/index.ios.js I also found a way to fix it in source and created a pull request #139
I have exactly the same problem. I have no clue how to fix this... did anybody succeded?
I modified index.ios.js to make it work for now. Replaced this.handleIncomingUrl to TnsOAuthClientAppDelegate.prototype.handleIncomingUrl.
Where are this file and this code? i can't find it in my project
At first I modified it directly in node_modules/nativescript-oauth2/delegate/index.ios.js I also found a way to fix it in source and created a pull request #139
- i already have your updated code, i didn't touched it but my current code is as your updated one and not the old one.
- I am using android and not IOS, how can i fix this for android?
Confirmed this is an issue on Android, not on iOS. Unaware of a fix at this time. Open to review PRs.
hi Alex @alexziskind1. I have the same issue as described above on ios with v3.0.1 of the plugin. The above fix worked for me as well even taught it should just be a temporary one as it's changing the .js file. So the PR motioned above that you close might be a valid one after all.
There was also a discussion in #135 that looks related even taught it says it's related to firebase.
include this at manifest activity tag
android:launchMode="singleTask"
Did not solved the problem
I am having this issue on a new angular code share project with the android emulated app.
Angular 11.0.4, Nativescript 7.0.0, "nativescript-oauth2": "^3.0.3"
tried editing the androidManifest.xml file with both
<data android:scheme="com.googleusercontent.apps.******-meqq8tqvl6v5em9a8pk8n4bbt0id64lv"/>
and
<data android:path"/auth" android:scheme="com.googleusercontent.apps.******-meqq8tqvl6v5em9a8pk8n4bbt0id64lv"/>
neither worked for returning to app
here is the google tnsOaProvider set up:
public configureOAuthProviderGoogle(): TnsOaProvider {
const googleProviderOptions: TnsOaProviderOptionsGoogle = {
openIdSupport: 'oid-full',
clientId: '******-meqq8tqvl6v5em9a8pk8n4bbt0id64lv.apps.googleusercontent.com',
redirectUri: 'com.googleusercontent.apps.******-meqq8tqvl6v5em9a8pk8n4bbt0id64lv:/auth',
urlScheme: 'com.googleusercontent.apps.******-meqq8tqvl6v5em9a8pk8n4bbt0id64lv',
scopes: ['email'],
};
I do not et any errors in the console when I open the debug tools via: devtools://devtools/bundled/inspector.html?ws=localhost:40000
From what I can trace, in the node_modules/nativescript-oauth2/delegate/index.android.js file line 3: args.activity.getIntent().getAction() is null when it should be android.intent.action.VIEW
the above "fix" from OniQ is only relevant for ios users even though the issue is with android as well.
My code is working fine before in iOS but now its redirecting to a google page after sign-in instead back to app, if you press done the tokenResult will be null the error result will be "The login operation was canceled".
with error "Safari cannot open the page because the address is invalid."
Its working fine before, not sure what happen. We also have firebase plugin on our app
any update on this issue on android?
so don't know if this helps tested on two emulators with android 9 and 10, noticed it worked on 10 not 9 for me
Tried using this on Default Pixel 4 image on android studio with android 11, default pixel 3 image with android 10, and pixel 2 with android 9, none of them worked for google integration. Just logged user in to google account and did not redirect back to app.
I would be willing to put some time into this but I am not sure where to start, can someone help me identify where to start debugging this issue?
Thanks for offering to help @kingjordan . This could be an issue with Android API level support or AndroidX library detection. Take a look at the gradle file included with the plug-in and the previous versions of the file and how it was changed. Accepting PRs.
This also happen on iOS after we implemented firebase for our push notification. After the user successfully logins it proceed to a goole search page instead of redirecting to the app.
Thanks for offering to help @kingjordan . This could be an issue with Android API level support or AndroidX library detection. Take a look at the gradle file included with the plug-in and the previous versions of the file and how it was changed. Accepting PRs.
@alexziskind1 thanks for the help getting started. I was not able to get any solution.
I tried the following:
- updating the dependencies in include.gradle to most current versions:
this did not change anything
- I added google play services because this doc indicates that we need it. so I added the following to app.gradle
and I added a before-plugins.gradle file with the following code:
I also tried with current version of play services v19 and again, no solution
-
I tried downgrading the package and tried all version between 3.0.1 and 3.0.3 (current) I reviewed the code changes in all of the files in those commits' and could not find anything to help.
-
Unfortunately, because of this issue with nativescript preview I am unable to confirm if this works on an actual device as others report.
I am not sure what else I can do to test this
thanks
Any update on this? or can anyone recommend another plugin that works with firebase?
Thanks to @OniQ for the iOS workaround. We hope it will be fixed soon.
I have started today with this plugin and I have encountered the problem on IOS.
@christiannepomuceno , did you managed to fix it. I have the same error. @alexziskind1 Could you help us with this? Is this possible to retrieve email with this plugin ?
@alexziskind1 This is an IOS issue and I've tried to also add
return TnsOAuthClientAppDelegate.prototype.handleIncomingUrl(url);
to the index.ios.js in the delegate folder but it still brings me to the google page. When can we expect a fix for this?