Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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)

  • 0.2.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
2
Weekly downloads
 
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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc