-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support OAuth #11
Comments
@Crizzooo I'm not sure I understand your question. Plaid has a very specific flow, when would a different OAuth flow occur? |
@JBaczuk Does this currently work with OAuth that redirects to Chase app, and then back to the RN app? |
@JBaczuk |
I'm not even sure this is possible, but I'll tag it as a feature request. |
@JBaczuk Thanks very much for putting together this package – saved me a lot of headache today. I do believe OAuth could hypothetically be implemented via Are you aware of any examples using |
Our app uses Expo and on internet I only found information to do it with react-native-cli and its pods. I was able to do this after a lot of struggle with Expo too! First I had to configure the client_id and public_key and add a Redirect URI on the Plaid dashboard (dashboard.plaid.com). The redirect URI has to end on ".html" and that link has to be a static HTML file that redirects you back to the app. My HTML file looks like this:
Of course you have to add "youapp" to your scheme on your app.json file, so your app recognizes the redirect with the link that looks like yourapp://whatever, for example:
and then handle the redirect with something like Then on the react-native code, I added the following methods:
and finally I used the component like this, where token its the link token that you get via plaid API sending as a minimum the redirectURI + your client id + your client name (docs here), and env its 'sandbox' or 'production' depending on the running environment.
(I already had the token because on my app I get it on the previous step/screen, you can also render the WebView conditionally after getting the link token on the same screen). Hope it helps! |
^^similar to the above comment, I was able to get OAuth working as well! One snag that held me up for a little while was that I was using |
Can Expo-Plaid provide more support here? Without best practices for Oauth for Expo-Plaid, the library is unusable. |
Happy to take PRs |
So it's fairly easy to get the I have this but it's failing when triggered:
|
@BFMarks I believe you need to encode the redirect URI as I mentioned above. Also, this library is certainly not unusable - we use it in production 🙂
|
Fair enough @apiel51 - I have tried To my previous comment, Plaid support specifically recommended against using the Webview in this manner (but ejecting Expo to basic RN doesn't sound like a fun alternative option either). Any support would be appreciated 🙏 |
@BFMarks I think Plaid support was mistaken as certain characters must be encoded or the URI is invalid. I believe you should use Here's a snippet of our code which might be helpful: const webviewRef = useRef<WebView>(null);
const plaidUri = `https://cdn.plaid.com/link/v2/stable/link.html?isWebview=true&token=${linkToken}`;
const PLAID_OAUTH_PATH = 'open/plaid_oauth_redirect';
useEffect(() => {
// Listens for when our app is deeplinked to
const handler: Linking.URLListener = ({ url }) => {
const { path } = Linking.parse(url);
if (path === PLAID_OAUTH_PATH) {
webviewRef.current?.injectJavaScript?.(
`window.open('${plaidUri}&receivedRedirectUri=${encodeURIComponent(
url,
)}')`,
);
}
};
Linking.addEventListener('url', handler);
return () => {
Linking.removeEventListener('url', handler);
};
}, [plaidUri]); Yeah I assume Plaid would recommend against it but oh well 🤷 |
So I managed to redirect back to my app, however I'm curious how y'all are handling the re-authentication when coming back? My experience goes from adding an account with Plaid, to a list of Bank Accounts, when a user is authenticated, to then re-directing to the app and authenticating the user. Are y'all passing in a session token ? Or you're re-authenticating the user ? |
Also, when you re-direct back to the app, how to you pass the account information obtained in the webview? I'm confused on that |
Nevermind! thanks everyone for your help, figured everything out based on the comments above. It took a little bit to understand everything that's needed, but it totally makes sense now. Thanks! |
Hello,
Not reporting a specific issue as much as asking a question.
Is the current webView implementation intended to work with OAuth flows? Such as Platypus in Sandbox, or Chase in production.
I believe we need to add code to be able to relaunch PlaidLink with a
receivedRedirectUri
.What do you think the current expected behavior is for OAuth flows?
The text was updated successfully, but these errors were encountered: