catalinmiron / react-native-plaid-link

React Native Plaid authenticator
124 stars 55 forks source link

account_id missing from connected response #11

Closed Gillinghammer closed 6 years ago

Gillinghammer commented 6 years ago

response metadata is missing account_id

using the test credentials: user_good / pass_good

Is this due to me using sandbox and the test credentials?

catalinmiron commented 6 years ago

I think so. Have you tried using development/production keys and got the same result?

Gillinghammer commented 6 years ago

Not yet. I’ll give that a go. Super helpful component, just what I needed!

Colin

On Sun, May 6, 2018 at 7:33 PM Catalin Miron notifications@github.com wrote:

I think so. Have you tried using development/production keys and got the same result?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/catalinmiron/react-native-plaid-link/issues/11#issuecomment-386901979, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjTGOMnwWKxqhk4541dCpuGytOOwjtWks5tv0ISgaJpZM4T0G0x .

Gillinghammer commented 6 years ago

Gave it a shot switching env to 'development' but now it generates a new error:

"Setting onMessage on a WebView overrides existing values of window.postMessage, but a previous value was defined."

Seems the development flow adds a captcha step which must interrupt the expected flow of the onMessage callback.

catalinmiron commented 6 years ago

I'll take a look today and hopefully get the fix :) I'll keep this issue open. Thanks!

muresanandrei commented 6 years ago

@Gillinghammer An fix for this is

`renderLogin() { const patchPostMessageFunction = () => { let originalPostMessage = window.postMessage; let patchedPostMessage = function(message, targetOrigin, transfer) { originalPostMessage(message, targetOrigin, transfer); };

      patchedPostMessage.toString = () => {
          return String(Object.hasOwnProperty).replace(
              'hasOwnProperty',
              'postMessage'
          );
      };
      window.postMessage = patchedPostMessage;
  };

  const patchPostMessageJsCode =
      '(' + String(patchPostMessageFunction) + ')();';

return (
      <PlaidAuthenticator
        onMessage={this.onMessage}
        publicKey="xxxxxxxxxxxxxxxxxx"
        env="development"
        product="auth,transactions"
        clientName="client"
        onLoad={this.onLoad}
        onLoadStart={this.onLoadStart}
        onLoadEnd={this.onLoadEnd}
        requires_code
        includeDisplayData={true}
        javaScriptEnabled={true}
        injectedJavaScript={patchPostMessageJsCode}
      />
);

}`