vippsas / vipps-login-api

Please see: Vipps MobilePay Technical Documentation: https://developer.vippsmobilepay.com
https://developer.vippsmobilepay.com
27 stars 26 forks source link

issues at Vipps Login with React Native Expo app #206

Closed konyan closed 1 year ago

konyan commented 1 year ago

Hello all,

I am trying to integrate Vipps Login via Azure B2C in the RN expo app. When the user clicks login with the Vipps button, the app calls Azure Oauth2 and then redirects to Vipps Website correctly, But the problem is while we try to test on Physical Android Device, the installed Vipps app opens. After the vipps app confirms redirects to my RN expo app. That broke our authorization flow. No token information containss in response

But It is working well on iOS devices because it doesn't redirect to the vipps app.

Broken flow after Vipps Test App Open (Android)

https://user-images.githubusercontent.com/6771972/220517047-ada17df6-1965-4aec-81b1-1e753d213fc3.mp4

Success flow at iOS without opening Vipps Test App

https://user-images.githubusercontent.com/6771972/220517443-58e70bfd-2380-4363-9a23-2c59fd503bef.mp4

I think the problem is when going to Vipps Web that redirects to Installed the Vipps app from devices, How do I stop opening vipps app from devices?

konyan commented 1 year ago

Adding appSwitch=false is the correct solution ? GET https://apitest.vipps.no/access-management-1.0/access/token?client_id=<your_client_id>&scope=<your_scope>&response_type=code&redirect_uri=<your_redirect_uri>&state=<your_state>&appSwitch=false

jonkjenn commented 1 year ago

@konyan The flow you're seeing on iOS is only the case when users happens to be remembered in the browser. Being redirected to the Vipps app is a required step of the Vipps Login flow when users are not remembered.

The issue in the Android flow is that the browser is not kept open on the return to your app. Our login flows depend on completing the login in a browser after returning from the Vipps app. We do have special support for app integrations that you can read more about here: https://vippsas.github.io/vipps-developer-docs/docs/APIs/login-api/vipps-login-api#app-to-app-flow

cloveras commented 1 year ago

We have some new documentation about Azure B2C that may be useful: https://developer.vippsmobilepay.com/docs/vipps-solutions/azure-b2c/

coco-konyan commented 1 year ago

thanks @cloveras @jonkjenn I found the solution in the documentation. final_redirect_is_app=false that return to the previous browser and working well.