React native Plaid Link OAuth iOS - after completing oauth authentication in external browser, redirects to app but not starts from where its left off - react-native

I've integrated plaid using react-native-plaid-link-sdk in my react-native ios project. For OAuth flow, as mentioned in the document, I've added the redirect uri for OAuth flow. It works fine, where I was successfully able to redirect and connect the User's bank account in the external browser. Once done, it redirects back to the application. But in the app it is not resumed from where it left off from the plaid view, instead the app restarts where the HANDOFF event in plaid is not invoked. So I'm unable to update the selected accounts and other details to the server.
I've followed the OAuth requirements given here https://github.com/plaid/react-native-plaid-link-sdk#oauth-requirements
react-native version is 0.68.0
plaid sdk version is 7.4.0
Please clarify if any other additional implementations should be done to handle OAuth flow in react native ios. Thanks.

Two suggestions:
First, make sure the appdelegate is correctly set up, if relevant to your application, as described in https://plaid.com/docs/link/oauth/#react-native-on-ios:
"The PlaidLink component handles Universal Links by default. For integrations that use PlaidLink.openLink, Universal Links will not be handled by default. The useDeepLinkRedirector hook must be invoked by the component that calls PlaidLink.openLink."
Second, upgrade to the latest version of the React Native SDK, which has improved handling of OAuth redirects.
If neither of these suggestions works, please go ahead and submit a ticket to Plaid Support.
(Credit for this answer goes to Nathan from Plaid Developer Support, I am just passing along his troubleshooting suggestions!)

Related

React Native integration with identity server

I have a react native app which is created using react-native-cli.
In official react native documentation it recommends to use react-native-app-auth which has too many issues reported.
However since it’s used by many i have started my implementation but came across many issues related Android.
Is there a recommended library that is maintained or tutorial that provides the guide to implement authentication using authorization code flow with PKCE?
Thanks in advance
AppAuth are the official libraries, though they are easier to integrate into a Kotlin based app, since the tech gets quite native in places:
Opening a Chrome Custom Tab
Registering redirect schemes
An Authorization Code Flow redirect
An Authorization Code Grant POST
A Refresh Token Grant POST
Secure storage of tokens on the device
Good login usability
Handling error and expiry conditions
AppAuth is primarily a pattern though, from RFC8252, so you could implement the above in Javascript code.
Start by implementing the above 3 OAuth messages and ensure that you understand payloads. Post back if you get stuck on areas such as PKCE and I can point you to some relevant JS code.
TRICKY AREAS
My Android Blog Posts may help you to clarify your requirements and explains some common problems and resolutions. There is a detailed code sample you can run locally also.
MOBILE TECH
I had a React Native sample in the past, but found the tech too painful in some areas:
Missing error details in responses from React-Native-App-Auth
Red screens when tracing HTTPS requests.
Therefore I switched everything to Kotlin where there are fewer tech layers to deal with.

React Native Login Using WebAuth redirection to browser from app

when login using Auth0 Webauth in React-Native it opens the browser for login.
I want to create a smooth login so that the user should not able to experienced whether I logged in using App or Browser jut like a webview anyone any idea?
Just to be clear are you asking if Auth0 supports doing this without a browser? Given that it's likely using OAuth2 or OpenID Connect then the short answer is no.
Further to that WebAuthn is a browser-based Javascript API so by definition would require a browser with these features to be available.
That said, there's probably nothing preventing you from implementing a native WebAuthn-like experience using CTAP2 (the protocol that sits underneath WebAuthn) directly or a platform-specific wrapper around the same.

Auth0 Rule Not Working w/ API Call from React Native App

I’ve been using Auth0 in my React web app. I also have a rule that works with new user sign ups. In my web (React) app, I use the Lock library and everything works fine.
Now, I created a React Native mobile app and because I have a custom login/sign up UI, I had to use the API method as opposed to using an Auth0 library such as Lock, etc.
My SignUp API calls work fine and create new users but my rule is NOT working with API calls. I checked to see if rules apply only to my web app but I don’t see any setting for that so I assume all rules should work for all apps that appear on my dashboard – including my new React Native mobile app.
The rule I created on Auth0 creates and assigns a new my_app_id to the new user. This rule has worked flawlessly with all sign ups coming from my web app which uses the Lock library but it doesn't seem to be firing when a new sign up comes in through the sign up API end point.
Is there anything I need to do so that my rule will work with my API calls?
Rules only run after a successful authentication event. This would not include a successful signup endpoint call, where no credentials are authenticated.
The recommended way to hook to a signup would be through a registration hook.

Can you interact with the app in test using absolute positioning in Detox?

I am trying to test a react native app on android which uses a native library which does oauth-based authentication using a webview. Detox does not support webviews (yet) so I was wondering if I could tap on the keyboard using coordinates in order to get through the auth (bad I know, but gets me unstuck for now).
Since the oauth screen is outside your app, I'd recommend you do the following:
Create E2E tests for your login up to the oauth screen
Get a CLI for your oauth provider or figure out how to authenticate via node.js to get the auth token
Create a deep link path in your app that accepts the token as a param and stores it the way you'd store it normally and trigger a continuation of the login flow (you may need to reverse engineer your native lib slightly)
This is generally the approach you want to take if you are using an external authentication party. If the party providing the auth package doesn't support 2 and 3, you should raise the issue with them.

Disable Twitter Universal Deep Links

Update: It appears Twitter has fixed this issue. Clicking the authorize button now works! Thank you all for the responses.
I have a UIWebView that opens and directs to Twitters Oauth/Authorize webpage. The user signs in with there Twitter details and authenticates the use of our application with there Twitter account. This process worked perfect before the release of Twitter 6.37 iOS application. What happens now is when the WebView detects https://twitter.com/oauth/authorize?oauth_token instead of staying in the WebView it opens the native Twitter application and dies. If you uninstall the Twitter application everything works as usually it staying within the WebView. How can I prevent this from happening? I want to stay within my UIWebView and not automatically open deep links. I have been reading about the new URL deep link changes in iOS 9, but not sure of how to stop them from my application to other native applications. Thanks for any help!
As a workaround, in twitter authentication screen we can use the Go button on iOS typing keypad instead of using the sign in button on web view until twitter fixes.
Please refer the attached screenshot link for clarity.
Screenshot for the workaround
I ran into this issue as well and figured out it was because my authorize endpoint was set to https://twitter.com/oauth/authorize?oauth_token="+oauthToken (I believe this was in the original documentation). If you add api as the subdomain: https://api.twitter.com/oauth/authorize?oauth_token="+oauthToken, it will no longer trigger the deep linking and load the twitter app.
My answer to this via a Xamarin question:
Unless Twitter removes/updates the apps section of "https://www.twitter.com/apple-app-site-association" to allow a bypass or a secondary oauth that is not in the apple-app-site-association file I do not see how you would do it. These files are signed and iOS handles them at an OS level.
I have not played around very much with the continueUserActivity delegate and the NSUserActivity object that is passed to apps launched from UNI links, but I do not see a way for the launched app (i.e. Twitter) to return control to the original app, and at that point the oauth call-chain would be broken anyway....
Unique. Unlike custom URL schemes, universal links can’t be claimed by other apps, because they use standard HTTP or HTTPS links to your website.
Secure. When users install your app, iOS checks a file that you’ve uploaded to your web server to make sure that your website allows your app to open URLs on its behalf. Only you can create and upload this file, so the association of your website with your app is secure.
Via: https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html
I would report as an issue (bug?) to Twitter's Dev forum: https://twittercommunity.com