Logging into website
Hey guys! Today we will learn how to log in using a Obyte wallet, and also make paid access to the article. To do this, we need project that i have prepared for you Tutorial-2-source. Install it.
git clone https://github.com/xJeneKx/Tutorial-2-source
cd Tutorial-2-source
npm installIf you run project you will see a blog with articles. After opening any article you will see a request to log in. Let’s create an authorization. First we need a pairing code, you could see it on startup
Copy it and change our code a bit
Run and see the link. Сlick on it and bot will be added. Now let’s look at the console.
Add the link
And QR
Save our device address, we will need it later.
Now we need to tell the browser that we are logged in To implement this, we add function in start.js
And also one more routing
In article.html we will add a request to check
What’s going on here? The user scans the QR code, adds our bot. Bot associates code with his device_address. In the browser, we knock and ask: did we logged in? and adding cookies.
Now we need to create an address and associate it with the user and the article. Add a variable
Add the address and display it
And finally the function getAssocAddress
This time we will not wait for the stabilization of the unit and immediately open access. Add a variable
Add a check that the user has paid for
Add a routing
And payment processing
That’s all, make a working second article - will be your homework:) You should get this: https://www.youtube.com/watch?v=vvB6A1wBecQ
All the code you can find on github. Did you like the lesson? Any questions? What topics have caused you difficulties and it is worth talking about them? Write in the comments and I will help you. Also join my telegram chat - @obytedev.
Last updated
Was this helpful?