alexziskind1 / nativescript-oauth

Other
35 stars 53 forks source link

Redirection URI on Android is getting ERR_UNKNOWN_URL_SCHEME #6

Closed jquintozamora closed 7 years ago

jquintozamora commented 7 years ago

Hi Alex, Thanks for your work on this library. I am testing your library with Android and I am getting this error. After that the app refresh again and it works, but the user experience isn't good.

Cheers!

androidError )

alexziskind1 commented 7 years ago

Hi Jose. I haven't seen that one. Thanks for pointing it out. I'd appreciate a PR from an Android folk like yourself ;) Thanks!

diogodomanski commented 7 years ago

Hi @alexziskind1,

I tried to run the demo project for Android platform. I set up Facebook auth. When I tap the login button, the webview is shown, but with an error message saying that I'm not logged in.

I opened the Facebook app and it was ok (with my user logged in). I opened the Facebook site from Chromium app, and my user was logged in as well.

It must be something related to cookies. What is the expected flow? What am I doing wrong?

Thanks

diogodomanski commented 7 years ago

After I've entered https://www.facebook.com/connect/login_success.html as my valid OAuth redirect URIs, it started to work (the login form was shown)

alexziskind1 commented 7 years ago

Hi @diogodomanski Thanks for pointing out the new URL! I'll get it in there soon.

playmuser commented 7 years ago

Hi, @alexziskind1, i'm implementing a facebook login with your library and when i call to: tnsOAuthModule.login().then(()=>{ console.log('logged in'); console.dir("accessToken " + tnsOAuthModule.accessToken()); this.router.navigate(["/drawer"]) }) the login is completing sucesfully and redirect me to _https://www.facebook.com/connect/login_success.html_ but never gets to print 'logged in', obviously neither prints the token and never calls the navigate... as consequence never leaves de webview with the login_sucess.html page..

What am I doing wrong?

Thanks

alexziskind1 commented 7 years ago

Hi playmuser, Please take a look at this video tutorial for using this plugin with Facebook: https://youtu.be/V0doxN0gkoI

On Sat, Jan 7, 2017 at 12:44 PM, playmuser notifications@github.com wrote:

Hi, @alexziskind1 https://github.com/alexziskind1, i'm implementing a facebook login with your library and when i call to: tnsOAuthModule.login().then(()=>{ console.log('logged in'); console.dir("accessToken " + tnsOAuthModule.accessToken()); this.router.navigate(["/drawer"]) }) the login is completing sucesfully and redirect me to https://www.facebook.com/connect/login_success.html https://www.facebook.com/connect/login_success.html but never gets to print 'logged in', obviously neither prints the token and never calls the navigate... as consequence never leaves de webview with the login_sucess.html page..

What am I doing wrong?

Thanks

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/alexziskind1/nativescript-oauth/issues/6#issuecomment-271098204, or mute the thread https://github.com/notifications/unsubscribe-auth/ABkAs9m-J1HoZiG6GAU2D-NWX-_9_Wqaks5rP87igaJpZM4KXsFJ .

--

Alexander Ziskind (Technical Director) +1 (855) 656-NUVI

playmuser commented 7 years ago

Thanks alex,

i saw the video few hours ago and solved my problem. I just changed one thing, instead of calling the login function, I called ensureValidToken and that problem and another one I had have been resolved

Very thankful!!

Enviado con Mailtrack https://mailtrack.io/install?source=signature&lang=es&referral=adangonzalez@playmuser.com&idSignature=23

2017-01-09 16:05 GMT+01:00 Alexander Ziskind notifications@github.com:

Hi playmuser, Please take a look at this video tutorial for using this plugin with Facebook: https://youtu.be/V0doxN0gkoI

On Sat, Jan 7, 2017 at 12:44 PM, playmuser notifications@github.com wrote:

Hi, @alexziskind1 https://github.com/alexziskind1, i'm implementing a facebook login with your library and when i call to: tnsOAuthModule.login().then(()=>{ console.log('logged in'); console.dir("accessToken " + tnsOAuthModule.accessToken()); this.router.navigate(["/drawer"]) }) the login is completing sucesfully and redirect me to https://www.facebook.com/connect/login_success.html https://www.facebook.com/connect/login_success.html but never gets to print 'logged in', obviously neither prints the token and never calls the navigate... as consequence never leaves de webview with the login_sucess.html page..

What am I doing wrong?

Thanks

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/alexziskind1/nativescript- oauth/issues/6#issuecomment-271098204, or mute the thread https://github.com/notifications/unsubscribe- auth/ABkAs9m-J1HoZiG6GAU2D-NWX-_9_Wqaks5rP87igaJpZM4KXsFJ .

--

Alexander Ziskind (Technical Director) +1 (855) 656-NUVI

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/alexziskind1/nativescript-oauth/issues/6#issuecomment-271306823, or mute the thread https://github.com/notifications/unsubscribe-auth/AX0fx382m5TX1n5dq102W016qyX6TZ_pks5rQkyigaJpZM4KXsFJ .

-- Adán González | CTO +34 618 07 08 25

Aviso legal

Este mensaje y sus archivos adjuntos van dirigidos exclusivamente a su destinatario, pudiendo contener información confidencial sometida a secreto profesional. No está permitida su reproducción o distribución sin la autorización expresa de DiamondFans,S.L. Si usted no es el destinatario final por favor elimínelo e infórmenos por esta vía.

De acuerdo con la LOPD, le informamos que sus datos personales y dirección de correo electrónico forman parte de un fichero, cuyo responsable es DiamondFans,S.L, siendo la finalidad del fichero, la gestión de carácter comercial y el envío de comunicaciones comerciales sobre nuestros productos y/o servicios.

Si lo desea, podrá usted ejercitar los derechos de acceso, rectificación, cancelación y oposición de sus datos enviando un mensaje a la siguiente dirección de correo electrónico a equipo@playmuser.com, indicando en la línea de “Asunto” el derecho que desea ejercitar.

plaramee1 commented 7 years ago

I know you closed it but I still receive the error that @jquintozamora pointed. Do you have any fix for that ?

Thanks !

alexziskind1 commented 7 years ago

Please provide versions of: OS: Node: npm: NativeScript CLI:

And your facebook login settings.

If you have a project sample somewhere, it would be helpful.

plaramee1 commented 7 years ago

Thanks for the fast reply! I'm on Windows 10 64bits latest (14393.693) node 6.9.1 npm 3.10.8 tns 2.5.0

I build and deploy to my Android Moto X play on Android 6.0.1 with all the latest Chrome / system web view installed

when I sign in on Office 365 (not using facebook) it work and get redirected to the application and I receive the token but for a second before the redirect, I see a "web page not available" in the web view like the screenshot posted by @jquintozamora

As far as a template, I started with the template from nativescript website : tns create HelloWorld --template nativescript-template-ng-tutorial

and added the code you showed in the video :

main.ts : var o365InitOptions: tnsOAuthModule.ITnsOAuthOptionsOffice365 = { clientId: 'My client guid', //client id for application (GUID) scope: ['Files.ReadWrite', 'User.ReadWrite', 'offline_access'] }; tnsOAuthModule.initOffice365(o365InitOptions);

app.component.ts : public onTapLogin() { tnsOAuthModule.ensureValidToken() .then((token: string) => { console.log('token: ' + token); }) .catch((er) => { console.error('error logging in'); console.dir(er); }); }

NB : I did build the same code on IOS 10 and I had no error or weird behavior on the redirect.

Thanks !

alexziskind1 commented 7 years ago

I was able to reproduce the issue. Reopening...

plaramee1 commented 7 years ago

You, Sir, are Super Effective ! Your modification to v 1.3.0 did it and it's working fine! Thanks a lot for such a fast fix.

alexziskind1 commented 7 years ago

@x3r10n Hope it helps :)

fofaria commented 5 years ago

@alexziskind1 hello hello and thank you for this amazing plugin! :) I'm using a custom provider and I'm getting the same error as @jquintozamora did in the beginning of this issue.

AndroidManifest.xml: `

    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <!-- Custom Path data -->
    <data android:scheme="com.companyName.mobile.s2"/>
  </intent-filter>`

on my custom provider configuration I have this as redirect uri: com.companyName.mobile.s2:/oauth2/token

os: macOS Mojave 10.14.5 (18F132) node: v10.15.3 npm: v6.4.1 tns: 5.4.2

thank you