API

Common

Getting Started
Errors and Codes

User

Register
Login
Get User Profile
Update Profile
Upload Avatar
Reset Password
Logout
Get Public User Profile

User Token

List Tokens
Add Token
Delete Token
Set Default Token
Verify Token
Reset Verification

User vAtom

Get vAtoms by IDs
Get vAtom Inventory
Search vAtoms
Get Actions
Perform Actions
Trash vAtom

User Activity

Get My Threads
Get My Thread Messages
Send Message

Map

Geo Discover vAtoms
Geo Discover vAtom Groups

Update Stream

Web Socket

Face Infrastructure

Face View Registration
Vatom View
Face Selection Procedure

Login

Overview

Log an existing user into the BLOCKv platform.

Three login options are supported, they are:

  1. Log in with a User token.
  2. Log in with a Guest ID.
  3. Log in with OAuth (Facebook).

Required imports

import io.blockv.common.model.User
import io.blockv.common.internal.net.rest.exception.BlockvException
import io.blockv.core.client.UserManager.TokenType

Requests

//login via email or phone
blockv.getUserManager().login(/*user-token,token-type,password*/)
//login via guest id
blockv.getUserManager().loginGuest(/*guest-id*/)
//login via oauth provider (facebook)
blockv.getUserManager().loginOauth(/*provider,oAuth-token*/)

Note: You can access the functions through the UserManager found in your blockv singleton. See Getting Started

Examples

Log in with a user token

Login via email

// blockv is the BLOCKv SDK singleton created in getting started
 blockv.getUserManager()
      .login("john.doe@example.com", UserManager.TokenType.EMAIL, "secret")
      .subscribe(user -> {/*Success*/},
      throwable -> {/*Failure*/});

Login via telephone number

// blockv is the BLOCKv SDK singleton created in getting started
 blockv.getUserManager()
      .login("+11234567890", UserManager.TokenType.PHONE_NUMBER, "secret")
      .subscribe(user -> {/*Success*/},
      throwable -> {/*Failure*/});

Log in with Guest ID

It is also possible to login using a guest_id. In the case where a vAtom was sent to a user that is not yet registered on the BLOCKv platform, the platform will create a temporary guest_id. The vAtom receiver can login with the guest_id as follows:

Login via guest ID

// blockv is the BLOCKv SDK singleton created in getting started
blockv.getUserManager()
      .loginGuest("guest_id")
      .subscribe(user ->{/*Success*/},
      throwable -> {/*Failure*/});

Login via facebook (OAuth)

When logging in via facebook, the token is omitted in the request since, it will be returned by the Facebook oAuth flow. Instead the oauth_token received from Facebook as part of the oAuth flow is submitted. The oauth_token will the be used to call the Facebook API and find the matching ID returned by Facebook.

Login via Facebook

// blockv is the Blockv sdk singleton created in getting started
blockv.getUserManager()
      .loginOauth("facebook", "Repalce with fb oAuth token")
      .subscribe(user -> {/*Success*/},
      throwable -> {/*Failure*/});
©2020 BLOCKv
Info