Home Reference Source
import {CloudCodeAuthContainer} from 'skygear-build/packages/skygear-core/lib/cloud/auth.js'
public class | source

CloudCodeAuthContainer

Extends:

AuthContainer → CloudCodeAuthContainer

Inherited Summary

From class AuthContainer
public get

accessToken: String

Current access token

public get

Currently logged-in user

public

async adminDisableUser(userOrUserID: Record | String, message: String, expiry: Date): Promise<String>

Disable user account of a user.

public

async adminEnableUser(userOrUserID: Record | String): Promise<String>

Enable user account of a user.

public

async adminResetPassword(userOrUserID: Record | String, newPassword: String): Promise<String>

Reset user password, require master key.

public

async assignUserRole(usersOrUserIDs: Record[] | String[], rolesOrRoleNames: Role[] | String[]): Promise<String[]>

Assigns roles to users.

public

async changePassword(oldPassword: String, newPassword: String, invalidate: Boolean): Promise<Record>

Changes the password of the current user.

public

async fetchUserRole(usersOrUserIDs: Record[] | String[]): Promise<Object>

Gets roles of users from server.

public

async login(authData: Object, password: String): Promise<Record>

Logs in to an existing user account with the specified auth data and password.

public

async loginWithEmail(email: String, password: String): Promise<Record>

Logs in to an existing user account with the specified email and password.

public

async loginWithProvider(provider: String, authData: Object): Promise<Record>

Logs in to an existing user account with custom auth provider.

public

async loginWithUsername(username: String, password: String): Promise<Record>

Logs in to an existing user account with the specified username and password.

public

async logout(): Promise

Logs out the current user of this container.

public

onUserChanged(listener: function()): EventHandle

Registers listener which user record changed.

public

async revokeUserRole(usersOrUserIDs: Record[] | String[], rolesOrRoleNames: Role[] | String[]): Promise<String[]>

Revokes roles from users.

public

async setAdminRole(roles: Role[]): Promise<String[]>

Defines roles to have admin right.

public

async setDefaultRole(roles: Role[]): Promise<String[]>

Sets default roles for new registered users.

public

async signup(authData: Object, password: String, data: Object): Promise<Record>

Creates a user account with the specified auth data, password and user record data.

public

async signupAnonymously(): Promise<Record>

Creates an anonymous user account and log in as the created user.

public

async signupWithEmail(email: String, password: String, data: Object): Promise<Record>

Creates a user account with the specified email, password and user record data.

public

async signupWithUsername(username: String, password: String, data: Object): Promise<Record>

Creates a user account with the specified username, password and user record data.

public

async whoami(): Promise<Record>

Retrieves current user record from server.