why deepstreamHub? compare us getting started feature roadmap faq
use cases pricing
developers
company
enterprise blog contact

Getting started with deepstreamHub is easy and takes less than ten minutes. However, if you have any questions, please get in touch.

This guide will take you through connecting a client via email authentication in deepstreamHub.

To do this, we'll be using the JavaScript client SDK.

Create a free account and get your API key

By default, email authentication is disabled in a deepstreamHub application. You can access and edit which types of authentication your users can login with via the Auth section in the dashboard. We'll just need to select the Email option, toggle it to on and click Save. It should look a bit like this once done:

email-auth

We also need to add the user to the application, this can be done via the HTTP API or via the Users section in the deepstreamHub dashboard. Here we can create a user with an email, password and any client or server data. Client and server data can be used within Valve for permissioning, however clients will also be forwarded their client data when logging in.

adding-user

Connect to deepstreamHub and log in

From here, you just need to include the JS-client library:

<script src="https://cdnjs.cloudflare.com/ajax/libs/deepstream.io-client-js/2.1.1/deepstream.js"></script>

or if you're using NodeJs:

const deepstream = require('deepstream.io-client-js')

Get your app url from the dashboard and establish a connection to deepstreamHub:

const client = deepstream('<YOUR APP URL>')

To login, we need to pass in an object with properties: type, email, password, and an optional callback. The callback will be called with a boolean, indicating whether the login was successful, and an object containing the user's id as well as any client data specified when creating the user.

client.login({
    type: 'email',
    email: 'alex@test.com',
    password: '.......'
}, (success, data) => {
    console.log(success, data) // true { favouriteColour: 'blue', id: '${uuid}' }
})

Where to go next?

To learn how to use deepstreamHub with Angular, React, Vue or other frontend frameworks, head over to the tutorial section. To learn how to use the JavaScript SDK with NodeJS rather than in a browser, head over to the getting started with NodeJS tutorial.

Video Demo

If you would like to learn more find out our video tutorial with Alex Harley, explaining more in detail about user authentication for a realtime store front in deepstreamHub.


Part 1: Backend

Part 2: Frontend