Hive Developer Portal
Understand the basics of using Hivesigner with your Hive application.
In this tutorial we will setup Hivesigner for demo application and step by step show the process of setting up dedicated account for your app to use Hivesigner Dashboard and setup backend of your application to use Hivesigner authorization properly.
The application in this tutorial asks the user to grant an access to
demo-app and get token from Hivesigner. Once permission is granted,
demo-app can get details of user via an api call that requires access token.
Purpose is to allow any application request permission from user and perform action via access token.
Some other calls that require an access token (or login) are:
Learn more about Hivesigner operations here
- Hivesigner Dashboard Create account for application and set up dashboard
- Initialize Hivesigner Initialize SDK in your application code
- Login URL Form login url for user
- Request token Request token with login url
- Set token Set or save token for future requests
- Get user data Get user details with token
- Logout Logout user and clear token
Hivesigner is unified authentification system built on top of Hive. Layer to ensure easy access and setup for all application developers as well as secure way for users to interact with Hive apps.
Setting up Hivesigner in your app is straight-forward process and never been this easy.
Here are the steps that helps you to setup new app:
1a. Visit Hivesigner Dashboard and login with your Hive credentials for your app
1b. You will see Account type, User and Application section, in Application section fill out details of App
1c. Give your app name, description, icon image link, website (if available) and Redirect URI(s)
Here is an example of Esteem form to give you idea how to fill form correctly.
Application name and description should give users clear understanding what permissions it requires and what is the purpose of the app.
App Icon field should be publicly accessible and available link to your logo or icon.
Website field is homepage for the application if exist.
Redirect URI(s) will be used within your application to forward user after authentification is successful. You can specify multiple callback URLs with each new line. Callback in Hivesigner SDK should match exactly one of URI(s) specified on this page. Due to security reasons if redirect URI(s) used in SDK is other than you specified, it will not work. This is typical backend web development, we hope you know how to set up your backend/app to handle callback URLs.
- Disclaimer: All images/screenshots of user interface may change as Hivesigner evolves
Once you have setup account for new application, you can setup application with Hivesigner authentification and API processes.
To do that, you will need to install
hivesigner nodejs package with
npm i hivesigner.
Within application you can initialize Hivesigner
app- is account name for application that we have created in Step I.3,
callbackURL- is Redirect URI that we have defined in Step I.4,
scope- permissions application is requiring/asking from users
hivesigner is initialized we can start authentication and perform simple operations with Hivesigner.
getLoginURLfunction you see on the right side, returns login URL which will redirect user to sign in with Hivesigner screen. Successfull login will redirect user to Redirect URI or
callbackURL. Result of successful login will return
usernameinformation, which application will start utilizing.
Application can request returned link into popup screen or relevant screen you have developed. Popup screen will ask user to identify themselves with their username and password. Once login is successful, you will have Results
Returned data has
access_token- which will be used in future api calls,
expires_in- how long access token is valid in seconds and
usernameof logged in user.
access_token, we can set token for future Hivesigner API requests.
Users info can be checked with
mewhich will return object
account- current state of account and its details on Hive blockchain,
scope- permissions allowed with current login,
user_metadata- additional information user has setup.
In order to logout, you can use
revokeTokenfunction from hivesigner.
That’s all there is to it.
To Run the tutorial
git clone https://gitlab.syncad.com/hive/devportal.git
npm run dev-serveror
npm run start
- After a few moments, the server should be running at http://localhost:3000/