🚀 DAY 3 OF LAUNCH WEEK:Announcing Bun and vlt Support in Socket.Learn more →
Socket
Book a DemoInstallSign in
Socket

thaipbs-account-client

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

thaipbs-account-client

JavaScript library for seamlessly authorization between sites under ThaiPBS (thaipbs.or.th)

latest
npmnpm
Version
0.2.0
Version published
Maintainers
2
Created
Source

ThaiPBS Account JS

JavaScript library for seamlessly authorization between sites under ThaiPBS (thaipbs.or.th)

Installation

Add this script tag in your web page:

<script src="https://account.thaipbs.or.th/sdk/thaipbs-account-client/v0.1.0/ThaiPBSAccountClient.js"></script>

You may also use this as a dependency via npm:

npm install thaipbs-account-client

Please note that when using via npm, you'll be required to use Babel to build your project.

Usage

To get current user info:

// For script tag, ThaiPBSAccountClient will be available globally.
// For npm, please import this.
//
// import ThaiPBSAccountClient from 'thaipbs-account-client';

var client = new ThaiPBSAccountClient();
var user = client.getUserInfo();
if (user) {
  console.log('Current user id: ' + user.id);
  console.log('Current user name: ' + user.name);
  console.log('Current user image: ' + user.image);
}

To login:

function onClickLoginButton() {
  client.authorize()
    .then(function(data) {
      if (data && data.user) {
        // Hooray! The user is logged in.
      }
    });
}

To show profile or login screen (based on current status):

function onClickProfileButton() {
  client.showProfile();
}

FAQs

Package last updated on 17 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts