client_sdk_nodejs
Client SDK for working with AcceleratXR powered services.
Yarn
yarn add @acceleratxr/core_sdk
NPM
npm i @acceleratxr/core_sdk
Usage
SDK Initialization
To setup and initilize the SDK...
JavaScript
const { Configuration, CoreSDK } = require("@acceleratxr/core_sdk");
var config = new Configuration({
baseUrl: "http://localhost:3000",
});
var sdk = new CoreSDK(config);
TypeScript
import { Configuration, CoreSDK } from "@acceleratxr/core_sdk";
const config: Configuration = new Configuration({
baseUrl: "http://localhost:3000",
});
const sdk: CoreSDK = CoreSDK(config);
Account Registration
To register a new user account...
JavaScript
const { Profile, User } = require("@acceleratxr/core_sdk");
var user = new User({
name: "username",
givenName: "John",
familyName: "Smith",
email: "john.smith@gmail.com"
});
user = await sdk.registerUser(user);
user = await sdk.registerUserAndPassword(user, "password");
TypeScript
import { Profile, User } from "@acceleratxr/core_sdk";
let user: User = new User({
name: "username",
givenName: "John",
familyName: "Smith",
email: "john.smith@gmail.com"
});
user = await sdk.registerUser(user);
user = await sdk.registerUserAndPassword(user, "password");
Device Login
JavaScript
const { User } = require("@acceleratxr/core_sdk");
await sdk.loginDevice();
var user = sdk.loggedInUser;
TypeScript
import { User } from "@acceleratxr/core_sdk";
await sdk.loginDevice();
const user: User = sdk.loggedInUser;
User/Pass Login
To authenticate using basic username and password...
JavaScript
const { User } = require("@acceleratxr/core_sdk");
sdk.onAuthChallenge = async () => {
return totp;
}
await sdk.loginPassword("username","password");
var user = sdk.loggedInUser;
TypeScript
import { User } from "@acceleratxr/core_sdk";
sdk.onAuthChallenge = async () => {
return totp;
}
await sdk.loginPassword("username","password");
var user = sdk.loggedInUser;
Password-less Login
To authenticate using password-less login via e-mail or phone...
JavaScript
const { User } = require("@acceleratxr/core_sdk");
await sdk.loginEmail("username");
await sdk.loginPhone("username");
await sdk.loginEmail("username","code");
await sdk.loginPhone("username", "code");
var user = sdk.loggedInUser;
TypeScript
import { User } from "@acceleratxr/core_sdk";
await sdk.loginEmail("username");
await sdk.loginPhone("username");
await sdk.loginEmail("username","code");
await sdk.loginPhone("username", "code");
const user: User = sdk.loggedInUser;
Single-Sign On (OAuth)
To authenticate using an OAuth compatible single-sign on provider...
JavaScript
const { User } = require("@acceleratxr/core_sdk");
var url = await sdk.requestOAuth2(OAuth2Provider.DISCORD);
await sdk.loginOAuth2(OAuth2Provider.DISCORD, code);
var user = sdk.loggedInUser;
TypeScript
import { User } from "@acceleratxr/core_sdk";
var url = await sdk.requestOAuth2(OAuth2Provider.DISCORD);
await sdk.loginOAuth2(OAuth2Provider.DISCORD, code);
const user: User = sdk.loggedInUser;
License
This software is licensed under a custom XBE EULA. By using it, you agree to the terms.