Skip to content
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

Api url has changed #5

Open
pedrolauro opened this issue Jun 25, 2018 · 19 comments
Open

Api url has changed #5

pedrolauro opened this issue Jun 25, 2018 · 19 comments

Comments

@pedrolauro
Copy link

I've been using this lib for a couple months, with everything ok.
Now I'm getting this error:

FetchError: request to https://prod-auth.nubank.com.br/api/token failed, reason: write EPROTO 140736572793792:error:14094412:SSL routines:ssl3_read_bytes:sslv3 alert bad certificate:../deps/openssl/openssl/ssl/s3_ pkt.c:1498:SSL alert number 42 140736572793792:error:1409E0E5:SSL routines:ssl3_write_bytes:ssl handshake failure:../deps/openssl/openssl/ssl/s3_pkt.c:659

I think the api URL has changed to this new url:

https://prod-s0-webapp-proxy.nubank.com.br/api/proxy/AJxL5LBUC2Tx4PB-W6VD1SEIOd2xp14EDQ.aHR0cHM6Ly9wcm9kLWdsb2JhbC1hdXRoLm51YmFuay5jb20uYnIvYXBpL3Rva2Vu

@DiogoAngelim
Copy link

DiogoAngelim commented Jun 26, 2018

Thanks @pedrolauro. How do I get the new API URL for the /registration endpoint?

@fakenickels
Copy link
Contributor

nice! thanks for pointing it out @pedrolauro, I'm going to take a look soon

@pedrolauro
Copy link
Author

pedrolauro commented Jun 26, 2018

@digelim Just try to login at Nubank's website and watch for XHR requests into the dev tools Network tab. I found the new URL doing that.
Later I just updated the new url on apis_uri.js file and it worked.

@fakenickels
Copy link
Contributor

when I first started doing the API wrapper there was an endpoint that enlisted all the other possible ones, if this one still exists maybe we could use it to always be up to date

@pedrolauro
Copy link
Author

After you successfully authenticated with that new url (and also the old one), the response includes a range of api's urls, for all kinds of functions for Nubank. But none for Nuconta, though..
Did you guys have seen any way to integrate with NuConta's API?

Btw, why the hell are we discussing this in english? lol =D

@fakenickels
Copy link
Contributor

Btw, why the hell are we discussing this in english? lol =D
I'm always talking in english at work so I'm on default mode haha, also makes sense if any "gringo" will see this in the future.

About the NuConta I don't think they made it public yet, gonna try to dig on that but probably is not allowed (if anyone from NuBank is reading this, please, let us know!)

@guilhermedecampo
Copy link
Member

summoning @rafaelcorreiapoli

@DiogoAngelim
Copy link

Thanks @grsabreu. One of the urls mentioned by pedrolauro is called "savings". But I don't know how to use that, sorry. There is no documentation :(

@RNT17
Copy link

RNT17 commented Dec 12, 2018

Quem consegue me ajudar no básico? Quero testar essa API, mas como faço pra executar o script?
Editado: Ok, eu fiz uma pergunta muito geral. Resumindo, adicionei o 'nubank' usando o yarn, e estou com um script .js como servidor de teste. O problema é que ta retornando um erro:

createNuBank is not a function

Apontando pra classe createNuBank();

meu código completo:

var http = require('http'),
  host = '127.0.0.1',
  port = '9000';
  
var server = http.createServer(function(req, res) {
	res.writeHead(200, {'Content-Type': 'text/html; charset=utf-8'});
    res.end("Servidor On!");
	}).listen(port, host, function() {
  	
  	console.log('Servidor rodando em http://' + host + ':' + port);
  	
	//import createNuBank from 'nubank'; Não suportado na minha versão do NodeJs
	const createNuBank = require("nubank");
  	const NuBank = createNuBank();

	NuBank.getLoginToken({
	  password: 'minhasSenha',
	  login: 'Meu CPF', // no dashes nor dots!
	}).then(response => console.log(`I'm in!`)) // just need to call this once

});

Detalhe. Não sou familiarizado com o NodeJs.

@ggviana
Copy link

ggviana commented Feb 28, 2019

@RNT17 Tente usar

const createNuBank = require("nubank").default;

@danilobarion1986
Copy link

There's 2 discovery URI's that can be used to get all API endpoints:
https://prod-s0-webapp-proxy.nubank.com.br/api/discovery and https://prod-s0-webapp-proxy.nubank.com.br/api/app/discovery

@guilhermedecampo
Copy link
Member

@danilobarion1986 cool man. Can you create a PR for us with this change?

@danilobarion1986
Copy link

danilobarion1986 commented Jun 9, 2019

@danilobarion1986 cool man. Can you create a PR for us with this change?

I'm developing an automated workflow to get my bills with Ruby because I'm not so familiar with Javascript... When I finish the part of use dynamic URL's I could try to translate it to Javascript and then open a PR here :)

Meanwhile, it's possible to call those endpoints manually and replace them in the code.

@dygufa
Copy link

dygufa commented Jun 10, 2019

@danilobarion1986 are you considering the qrcode step required to get the "events link"?
I'm also trying to use nubank's api to get my purchase list but from what I'm seeing I will have to use: i) discovery links; ii) login link; iii) lift link (which involves reading a qrcode); iv) and finally events link.
Do you have a different approach on mind?

@danilobarion1986
Copy link

@danilobarion1986 are you considering the qrcode step required to get the "events link"?
I'm also trying to use nubank's api to get my purchase list but from what I'm seeing I will have to use: i) discovery links; ii) login link; iii) lift link (which involves reading a qrcode); iv) and finally events link.
Do you have a different approach on mind?

Yes, this is the exact workflow to authenticate. As I said before, I won't be able to make a PR with the javascript code, but I finish my ruby automation (it can be viewed here). Before I made it I tried to use a python automation, but I encounter some errors with it and then decided to roll out my own.

@dygufa
Copy link

dygufa commented Jun 10, 2019

@danilobarion1986 are you considering the qrcode step required to get the "events link"?
I'm also trying to use nubank's api to get my purchase list but from what I'm seeing I will have to use: i) discovery links; ii) login link; iii) lift link (which involves reading a qrcode); iv) and finally events link.
Do you have a different approach on mind?

Yes, this is the exact workflow to authenticate. As I said before, I won't be able to make a PR with the javascript code, but I finish my ruby automation (it can be viewed here). Before I made it I tried to use a python automation, but I encounter some errors with it and then decided to roll out my own.

Thanks!
I'm already finishing an implementation using Javascript following the workflow described above, however, I'm not sure if it fits this api considering it would be a huge breaking change this new qrcode requirement.
It only makes sense in a major release (or maybe not considering it's already broken).

@danilobarion1986
Copy link

Cool @dygufa !
I think that fix the dynamic URI issue and add other login flow, considering QR Code validation, are two different things (If someone is already using login without QR Code, what I don't know if it is possible...).

But if everybody needs a QR Code to log in them I agree with you that is better to launch a new breaking version and deprecate this one

@renanbatel
Copy link

renanbatel commented Apr 5, 2020

Hi, just passing by to say that I decided to create a project to create a JS library for Nubank's API with all the QR Code authentication and stuff. Thanks for your ruby project @danilobarion1986, it was a great help. I already made an npm package for it, you can check it here.

@danilobarion1986
Copy link

Hi, just passing by to say that I decided to create a project to create a JS library for Nubank's API with all the QR Code authentication and stuff. Thanks for your ruby project @danilobarion1986, it was a great help. I already made an npm package for it, you can check it here.

Just saw your comment on the npm lib you wrote, really appreciate man!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants