Home Reference Source Repository
import AuthRocket from 'authrocket/src/authrocket.js'
public class | source

AuthRocket

Constructor Summary

Public Constructor
public

constructor(settings: *)

Member Summary

Public Members
public

apiUrl: *

Method Summary

Public Methods
public

AuthProviders(actionData: *): *

AuthProviders action namespace

public

ConnectedApps(actionData: *): *

ConnectedApps action namespace

public

Credentials(actionData: *): *

Credentials action namespace

public

Events(actionData: *): *

Events action namespace

public

Hooks(actionData: *): *

Hooks action namespace

public

Memberships(actionData: *): *

Memberships action namespace

public

Notifications(actionData: *): *

Notifications action namespace

public

Orgs(actionData: *): *

Orgs action namespace

public

Realms(actionData: *): *

Realms action namespace

public

Sessions(actionData: *): *

Sessions action namespace

public

SignupTokens(actionData: *): *

SignupTokens action namespace

public

Users(actionData: *): *

Users action namespace

public

login(loginData: Object): Promise

Login as a user

public

logout(token: String): Promise

Logout a user

public

signup(signupData: Object): Promise

Signup a new user

public

verify(token: String, expand: String): Promise

Verify an existing token is valid

Public Constructors

public constructor(settings: *) source

Params:

NameTypeAttributeDescription
settings *

Public Members

public apiUrl: * source

Public Methods

public AuthProviders(actionData: *): * source

AuthProviders action namespace

Params:

NameTypeAttributeDescription
actionData *

Return:

*

public ConnectedApps(actionData: *): * source

ConnectedApps action namespace

Params:

NameTypeAttributeDescription
actionData *

Return:

*

public Credentials(actionData: *): * source

Credentials action namespace

Params:

NameTypeAttributeDescription
actionData *

Return:

*

public Events(actionData: *): * source

Events action namespace

Params:

NameTypeAttributeDescription
actionData *

Return:

*

public Hooks(actionData: *): * source

Hooks action namespace

Params:

NameTypeAttributeDescription
actionData *

Return:

*

public Memberships(actionData: *): * source

Memberships action namespace

Params:

NameTypeAttributeDescription
actionData *

Return:

*

public Notifications(actionData: *): * source

Notifications action namespace

Params:

NameTypeAttributeDescription
actionData *

Return:

*

public Orgs(actionData: *): * source

Orgs action namespace

Params:

NameTypeAttributeDescription
actionData *

Return:

*

public Realms(actionData: *): * source

Realms action namespace

Params:

NameTypeAttributeDescription
actionData *

Return:

*

public Sessions(actionData: *): * source

Sessions action namespace

Params:

NameTypeAttributeDescription
actionData *

Return:

*

public SignupTokens(actionData: *): * source

SignupTokens action namespace

Params:

NameTypeAttributeDescription
actionData *

Return:

*

public Users(actionData: *): * source

Users action namespace

Params:

NameTypeAttributeDescription
actionData *

Return:

*

Example:

//Get users list
authrocket.Users().get().then(function(loadedUser){
 console.log('User found:', loadedUser);
});
//Get user by username
authrocket.User('someguy1').get().then(function(loadedUser){
 console.log('User found:', loadedUser);
});

public login(loginData: Object): Promise source

Login as a user

Params:

NameTypeAttributeDescription
loginData Object

Object containing data to signup with

loginData.email String

Email of new user

loginData.username String

Username of new user

loginData.password String

Password of new user

Return:

Promise

Example:

//login as a user
var userData = {username: 'testuser1', password: 'secretstring'};
authrocket.login(userData).then(function(newUser){
   console.log('Successful signup:', newUser);
});

public logout(token: String): Promise source

Logout a user

Params:

NameTypeAttributeDescription
token String

String JWT token of logged in user

Return:

Promise

Example:

//logout based on token
var token = 'b89787f98728rcn8279.898er89qb8bsf.98basdfasd';
authrocket.logout(token).then(function(){
   console.log('Logged out successfully.');
});

public signup(signupData: Object): Promise source

Signup a new user

Params:

NameTypeAttributeDescription
signupData Object

Object containing data to signup with

signupData.email String

Email of new user

signupData.password String

Password of new user

signupData.confirm String

Object containing data to signup with

Return:

Promise

Example:

//signup
var userData = {username: 'testuser1', email: 'test@test.com', password: 'secretstring'};
authrocket.signup(userData).then(function(newUser){
   console.log('Successful signup:', newUser);
});

public verify(token: String, expand: String): Promise source

Verify an existing token is valid

Params:

NameTypeAttributeDescription
token String

JSON Web Token to verify

expand String

Values to expand (memberships and/or token)

Return:

Promise

Example:

//verify token and return membership and token data
var token = 'b89787f98728rcn8279.898er89qb8bsf.98basdfasd';
authrocket.verify(token , 'memberships,token').then(function(response){
   console.log('token is valid. User data:', response);
});