@playo/auth

Playo auth

Stats

StarsIssuesVersionUpdatedCreatedSize
@playo/auth
0.5.02 years ago3 years agoMinified + gzip package size for @playo/auth in KB

Readme

Playo auth

Example

const PlayoAuth = require("@playo/auth");

const auth = new PlayoAuth({
  redisUrl: "", // default localhost
  redisPort: "", // default 6379
  ttl: "" // default 7776000s (3 months)
});

async loginFunc() {
  const authData = await auth.login(userId) // userId will always be uuid
  /*
    authData

    {
      token: 'token' || null
      error: null || error message
    }
  */

}

async logoutFunc() {
  const authData = await auth.logout(token) // token will always be `uuid:uuid`
  /*
    authData

    {
      status: boolean // true if user is logged out successfully
      error: null || error message
    }
  */

}

async verifyFunc() {
  const authData = await auth.verify(token) // token will always be `uuid:uuid`
  /*
    authData

    {
      status: boolean // true if token is valid
      error: null || error message
    }
  */

}

async expireAll() {
  const authDate = await auth.expireAll(userId) // userId will always be UUID
  /**
   authDate
   {
     status:boolean  // true if all the tokens are expired
   }
   * /
}

checkDB () => {
  const isConnected = auth.checkConnection() // boolean

}

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.