node-bank icon indicating copy to clipboard operation
node-bank copied to clipboard

Crypto error.

Open saulojoab opened this issue 5 years ago • 4 comments
trafficstars

Installed the module using npm install node-bank, and imported it on my React Native project. Here's my code:

        await nubank.start();
        await nubank.login({ cpf: 'mycpf', pass: 'mypass' });
        
        let arr = await nubank.events.findAll();
        console.warn(arr);

So far so good, but here's the catch: when I run the app, it says it can't find the crypto module. I installed it with npm i crypto and tried to run it again. Here's what I got:

error: bundling failed: Error: While trying to resolve module `crypto` from file `/home/saulo/Projetos/PersonalProjects/monyie-react/node_modules/request/lib/helpers.js`, the package `/home/saulo/Projetos/PersonalProjects/monyie-react/node_modules/crypto/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/home/saulo/Projetos/PersonalProjects/monyie-react/node_modules/crypto/index.js`. Indeed, none of these files exist:

  * /home/saulo/Projetos/PersonalProjects/monyie-react/node_modules/crypto/index.js(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
  * /home/saulo/Projetos/PersonalProjects/monyie-react/node_modules/crypto/index.js/index(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)

How should I proceed? Thanks in advance.

saulojoab avatar Jan 08 '20 17:01 saulojoab

Hi!

Issue in analyze 🍇

nulldreams avatar Jan 09 '20 12:01 nulldreams

Pretty sure it's because NodeJS and React don't use the same Javascript version.

I'm trying to re-write your API so I can use it with React but when I authenticate I don't get a "events" URL on my logged urls, I only get these:

account_emergency
bill_emergency
revoke_all
revoke_token

and the token stuff. Where did the events URL came from?

saulojoab avatar Jan 09 '20 23:01 saulojoab

When I created this repository, the Nubank Authentication API returned a json with the events. However, they have changed the login flow, now you need to validate a QRCode to have access to this events object.

I'm working on a new version that has QRCode validation, so if you want to create it in your React App, there is a Python project that has this QRCode implementation: https://github.com/andreroggeri/pynubank

You can take a look at it and recreate the flow.

nulldreams avatar Jan 10 '20 11:01 nulldreams

Oh, I see. Nubank really should document their API lol, so confusing.

Thank you very much!

saulojoab avatar Jan 10 '20 12:01 saulojoab