Add SteemLogin to your app!

Integrating your Steem application with SteemLogin is easy!

Simply follow the instructions below and you will be up and running in a very short amount of time.

1. Add a "Sign In", or "Login" link to your app

The link should specify the following URL:

                  https://auth.steemlogin.net
                
along with your application name registered with SteemLogin (see Register your App for more details), as a query parameter.

In its simplest form the link can be provided as an anchor tag, as follows:

                  LOGIN
                

2. Servicing your Authentication Success URL

Upon successfully authenticating with SteemLogin users will be redirected to your Success URL.

A unique authorization code will be suppllied to your app within the query parameters. For example:

https://localhost:8080/steemlogin/success?authCode=OI7SXfO5H8oBBJbYLCPiT220mpXGz83DDmdZIBeNHikX

To retrieve the user details, you should now supply the authorization code to a GET HTTPs request addressed to the following URL:

https://auth.steemlogin.net?authDetails&authCode=OI7SXfO5H8oBBJbYLCPiT220mpXGz83DDmdZIBeNHikX

The above request should return a 200 HTTP status code along with JSON encoded data in the response body.

The response data will include among other things:

  • steemUsername: The Steem username
  • steemPostingKey: The Steem posting key
  • providerId: Identifies which provider was used to authenticate the user (e.g. 'google.com')

3. Store and use the user details securely

It is now the responsibility of your application to store the user information securely.
We recommend encrypting all sensitive information returned by SteemLogin within the client side of your application (e.g. browser).
For example, this can be achieved using the Subtle Crypto API and storing the encryption key within a indexedDB database

4. If you are migrating from Steemconnect to SteemLogin

Updating your code to make use of the Steem username and posting key instead of the Steemconnect token to initiate an operation on the Steem blockchain is easy.

We recommend using dsteem to make the process easy as SteemConnect and dsteem APIs are quite similar.

Below is an example that illustrates how authentication details would be decrypted and used to upvote a particular post.

   decryptAuthDetails(encryptedAuthDetails,
        .then((authDetails) => {
          dsteem.broadcast.vote(                                                                                         
            {
              voter: authDetails.steemUsername,
              author: blog.author,
              permlink: blog.permlink,
              weight: voteWeight
            },
            PrivateKey.fromString(authDetails.steemPostingKey)
          ).then(() => {
			...
          }).catch((err) => {
			...
          })
        })
              


Testing your app before deployment

SteemLogin supports redirecting users to your development URLs so that you can test the authentication process before deployment to your production server.

Simply let us know your desired success and failure development URLs, as indicated on the app registration page.

Make sure then to specify the dev query parameter when linking the steemlogin authentication gateway.
For example:

                https://auth.steemlogin.net?app=myapp&dev
              

Testing an authentication failure

You can test a failure condition during authentication. SteemLogin will then redirect the user to your authentication failure URL.

To test this, simply supply the testfailure query parameter. For example:

                https://auth.steemlogin.net?app=myapp&dev&testfailure