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

@netology-group/account

Package Overview
Dependencies
Maintainers
4
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@netology-group/account

account client

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-73.33%
Maintainers
4
Weekly downloads
 
Created
Source

account

account client

How to use

Import module

Use es6 import

import Account, { IdP } from 'account'

Initialize

const config = {
  provider: new IdP({
    endpoint: '...host...'
  }),  // you can write your own provider or use default IdP provider
  id: '..id...' // optional parameter (if you already know `id` you pass in `config` to avoid repeated request of token)
}
const account = new Account(config)

Get access token

const authKey = 'oauth2.key'
const params = {
  client_token: '...JWT TOKEN...',
  grant_type: 'client_credentials'
}
const accountId = '..id...'
account.signIn(/* { auth_key: authKey, params: params } || { refresh_token: '...JWT TOKEN...' } */)
  .then((data) => {
    // {
    //   access_token: '...',
    //   expires_in: 86400,
    //   refresh_token: '...',
    //   token_type: 'Bearer'
    // }
  })

Refresh access token

account.signIn(/* { auth_key: authKey, params: params } || { refresh_token: '...JWT TOKEN...' } */)
  .then(account.refresh(id)) // id or 'me'
  .then((data) => {
    // {
    //   access_token: '...',
    //   expires_in: 86400,
    //   token_type: 'Bearer' 
    // }
  })

Revoke refresh token

account.signIn(/* { auth_key: authKey, params: params } || { refresh_token: '...JWT TOKEN...' } */)
  .then(account.revoke(id)) // id or 'me'
  .then((data) => {
    // {
    //   refresh_token: '...'
    // }
  })
account.signIn(/* { auth_key: authKey, params: params } || { refresh_token: '...JWT TOKEN...' } */)
  .then(account.link(authKey, params))
  .then((data) => {
    // {
    //   id: '1'
    // }
  })

Get linked accounts

account.signIn(/* { auth_key: authKey, params: params } || { refresh_token: '...JWT TOKEN...' } */)
  .then(account.auth(id)) // id or 'me'
  .then((data) => {
    // [{
    //   id: 'oauth.key'
    // }]
  })
account.signIn(/* { auth_key: authKey, params: params } || { refresh_token: '...JWT TOKEN...' } */)
  .then(account.unlink(id, authKey)) // id or 'me'
  .then((data) => {
    // {
    //   "id": "oauth2.key.1"
    // }
  })

Get account info

account.signIn(/* { auth_key: authKey, params: params } || { refresh_token: '...JWT TOKEN...' } */)
  .then(account.get(id)) // id or 'me'
  .then((data) => {
    // {
    //   id: ''
    // }
  })

Delete access token

account.signOut()
  .then(() => { /* do something */ })

FAQs

Package last updated on 27 Apr 2018

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