New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tucmc-auth

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tucmc-auth

## API Setup Guide using npm

  • 0.0.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-57.14%
Maintainers
1
Weekly downloads
 
Created
Source

TUCMC Auth API

API Setup Guide using npm

_app.js or _app.tsx
import {AuthProvider} from "tucmc-auth"

function MyApp({Component, pageProps}) {

  return (
    <div>
      <AuthProvider TOKEN="-----TOKEN-----">
        <Component {...pageProps} />
      </AuthProvider>
    </div>
  )

}

export default MyApp
pages/index.js or pages/index.tsx
import {useAuth} from 'tucmc-auth'

function Index() {

  const {userData, SigninWithTUCMC, signout} = useAuth()

  return (
    <div>
      {userData && <h1>Hi, {userData.firstname}</h1>}
      <SigninWithTUCMC/>
    </div>
  )
}

export default Index

Setup Guide using javascript CDN

Library Resources CDN

CSS: https://lib.account.triamudom.ac.th/tucmc-auth@0.0.8.css
Script: https://lib.account.triamudom.ac.th/tucmc-auth@0.0.8.js

1. Include all required libraries

<link rel="stylesheet" href="https://lib.account.triamudom.ac.th/tucmc-auth@0.0.8.css"/>
<script type="text/javascript" src="https://lib.account.triamudom.ac.th/tucmc-auth@0.0.8.js"></script>
<script async src="//cdn.jsdelivr.net/npm/@fingerprintjs/fingerprintjs@3/dist/fp.min.js" onload="init()"></script>

2. Setup a script

<script>
    const auth = new TUCMCAuth("-----TOKEN-----")

    window.onload = function () {
        const sessionData = auth.user()
        
        // If session is valid, update an element with userdata.
        if (sessionData) {
            document.getElementById("email").innerText = sessionData.email
        }
    }
</script>

3. Add sign-in button

<!---Button id must be `login_with_TUCMC`--->
<button id="login_with_TUCMC" class="login_with_TUCMC">
    Login with TUCMC
</button>

<!---Logout button--->
<button onclick="auth.signout()">logout</button>

<!---Display data here--->
<p id="email"></p>

made with ♥ by Triam Udom Clubs Management Committee

FAQs

Package last updated on 19 Aug 2021

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