Updating Steemline to work with the new Steemconnect API
Steemline is a browser based app with a slick UI that makes it easy to follow what interests you on the steem network.
Steemconnect is an authentication tool for the Steem network. The main benefit it provides is a better security / trust model. If you had to provide your password to every app built on Steem, you would be taking a large risk of your account being hacked or misused. But with Steemconnect, you only need to entrust your password (or key, etc) with just one entity. Other apps just need to request authentication tokens with Steemconnect. These tokens have limited power and can be revoked by you any time. Well atleast in version 2 of Steemconnect they can.
Version 2 of Steemconnect follows a standard model of authentication called oAuth. This is how it roughly works:
- The user clicks a login button on app's website
- The user is directed to
https://v2.steemconnect.com/...where they can sign in and approve the app's request for authentication. A list of "permissions" required by the app is shown to the user, so that the user can make an informed decision.
- If the user approves, then they are redirected back to the app's website.
My goal was to add Steemconnect v2 support to Steemline, to bring it in line with modern practices. Doing this was pretty easy once I got familiar with Steemline's code.
Steemline currently uses PHP for its backend. The amount of backend code is very little, and there are plans to move to full JS stack. The frontend is built in pure JS with VueJS, and there are plans to move to Typescript; but that's for a later post.
- The first step was to register an app with Steemconnect. There a nice post about it by @noisy
- Then, I added a redirect to the Steemconnect website
- Next was to add routes in the backend to store the auth tokens when the user is redirected back to the service
- This token had to be stored in the session data of the user so that it could be used in the rest of the app
- The final step was to integrate the new initialise/comment/vote/API with the rest of the code.
- to @mkt for creating the app in the first place. He is also a very chill developer to interact with.
- to @noisy for creating the steemconnect guide
Posted on Utopian.io - Rewarding Open Source Contributors