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(user: Record | String, message: String, expiry: Date): Promise<String>

Disable user account of a user.

public

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

Enable user account of a user.

public

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

Reset user password, require master key.

public

async assignUserRole(users: Record[] | String[], roles: Role[] | String[]): Promise<String[]>

Assigns roles to users.

public

async authHandler(): Promise

Auth flow handler script

public

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

Changes the password of the current user.

public

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

Gets roles of users from server.

public

async forgotPassword(email: String): Promise

Send a forgot password email to the email address.

public

Get redirect link result, return user from redirect based login flow if link success, promise resolve with result { result: 'OK' }.

public

Get redirect login result, return user from redirect based login flow if login success, promise resolve with logged in user.

public

async getOAuthProviderProfiles(): Promise

Get current user's provider profiles, can use for determine user logged in provider

public

async iframeHandler(): Promise

Iframe handler script.

public

async linkOAuthProviderWithAccessToken(provider: String, accessToken: String): Promise

Link oauth provider with access token

public

async linkOAuthProviderWithPopup(provider: String, options: Object): Promise

Link oauth provider with popup window

public

linkOAuthProviderWithRedirect(provider: String, options: Object): Promise

Link oauth provider with redirect

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 loginOAuthProviderWithAccessToken(provider: String, accessToken: String): Promise

Login oauth provider with access token

public

async loginOAuthProviderWithPopup(provider: String, options: Object): Promise

Login oauth provider with popup window

public

loginOAuthProviderWithRedirect(provider: String, options: Object): Promise

Login oauth provider with redirect

public

async loginWithCustomToken(token: String): Promise

Login with custom token.

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 requestVerification(recordKey: String): Promise

Request to verify user data.

public

async resetPassword(userID: String, code: String, expireAt: Number, newPassword: String): Promise

Reset password with a code generated by the server.

public

async revokeUserRole(users: Record[] | String[], roles: 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 unlinkOAuthProvider(provider: String): Promise

Unlink oauth provider

public

async verifyUserWithCode(code: String): Promise

Verify user by specifying verification code sent by server.

public

async whoami(): Promise<Record>

Retrieves current user record from server.