V
V
Vladislav2017-07-08 15:29:35
Node.js
Vladislav, 2017-07-08 15:29:35

Node.js & Nw.js & YandexMoney API exit point with parameter passing?

Hello. I am writing a program on a node and I need to use the Yandex Money API.
They have an SDK for the node : https://github.com/yandex-money/yandex-money-sdk-nodejs
only after filling in all the fields and permission for the application, Yandex redirects to any page with the site_url?code=CODE parameter.
I decided to use nw.js to open a browser window. The user enters all the data, gives access to the application, it redirects to my url, but how can I get this parameter? I can't find an event in nw.js for this. There is loaded, but it only fires on the login page, and if the user is redirected, then the event does not fire. That is, you need to open a browser window => wait for the CODE parameter to be received => close the window => pass CODE to Node.js. Is it even possible? Or I misunderstood this line from the documentation:

After that, user fills Yandex.Money HTML form and user is redirected back to REDIRECT_URI?code=CODE

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav, 2017-07-09
@vlad00777

And I answer myself:
It is necessary to create a server and listen to it in order to receive data. Accordingly, in the Yandex Money application, you need to put the Redirect URI, for example, on localhost: 8030 , but in the node:

http.createServer(function(req, res) {
console.log(req);
}).listen(8030);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question