burstware / expo-plaid-link

Use the Plaid Link flow inside your expo app
MIT License
35 stars 20 forks source link

onSuccess callback not returning publicToken. #6

Closed jdbarrera closed 3 years ago

jdbarrera commented 3 years ago

The onSuccess callback is not returning the publicToken. I only get an object with the metadata. However, you can see it in the event URL. This was working yesterday but stopped today suddenly. Capture

chadlaughland commented 3 years ago

Having the same issue here. Was working properly and all of a sudden is not returning the publicToken correctly. Logging the eventParams extracted from queryString.parse(event.url) reveals the publicToken key as:

plaidlink://connected?public_token: "public-sandbox-6a2064fe-8386-4126-9931-e3ce715a3330" rather than public_token: "public-sandbox-6a2064fe-8386-4126-9931-e3ce715a3330"

Its parsing the key with the 'plaidlink://connected?' pre-pended. Not sure if Plaid changed the url scheme or if queryString is broken.

I fixed it on my project by modifying line 31 of PlaidLink.tsx. Basically adding the replace regex onto the event.url passed to queryString.parse() const eventParams = queryString.parse(event.url.replace(/plaidlink:\/\/event|plaidlink:\/\/exit|plaidlink:\/\/connected/gi, ""))

Not sure if thats the best way but it should get this working again for the moment.

jdbarrera commented 3 years ago

That's a clever fix! I ended up just ejecting and using Plaid's native component. I'll have to try this though. Thanks!

udaraweerasinghege commented 3 years ago

Bump on this. @JBaczuk do you have plans on integrating something like what @chadlaughland suggested?

JBaczuk commented 3 years ago

Bump on this. @JBaczuk do you have plans on integrating something like what @chadlaughland suggested?

Hi! Yes I would happily review a PR. It looks like Plaid made a breaking change to their API.

udaraweerasinghege commented 3 years ago

Awesome! Thanks for creating and maintaining this project! I created a PR here https://github.com/burstware/expo-plaid-link/pull/7

JBaczuk commented 3 years ago

Fixed in https://github.com/burstware/expo-plaid-link/pull/7. Published in versions 1.0.3 and above.