Socket
Socket
Sign inDemoInstall

twitch-auth

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

twitch-auth

Utility module for handling Twitch.tv chatbot authentication.


Version published
Weekly downloads
593
increased by12.52%
Maintainers
1
Weekly downloads
 
Created
Source

twitch-auth

Utility module for handling Twitch.tv chatbot authentication. The authentication process is detailed here.

exports

The following functions are exported by the module.

getUserAccessToken(creds, code)

Gets a user access token required for login (using tmi.js for example). This should be used once after the initial authorization step. Subsequent logins should use the token refresh process.

creds is an object structured as follows:

{
"client_id": <your client ID>,
"client_secret": <your client secret>
}

code is the OAuth 2.0 authorization code returned by Twitch.

Returns a Promise that resolves to an object parsed from the JSON returned from the server, or rejects with an error. The returned object looks like this:

{
  "access_token": "<user access token>",
  "refresh_token": "<refresh token>",
  "expires_in": <number of seconds until the token expires>,
  "scope": "<your previously listed scope(s)>",
  "token_type": "bearer"
}

refreshUserAccessToken(creds, refreshToken)

Gets a new (refreshed) user access token for login.

creds ...same as above.

refreshToken is the refresh_token returned from the server in calls to getUserAccessToken() and/or refreshUserAccessToken().

getAppAccessToken(creds)

Gets an app access token. This is not applicable to chat login, but I wrote the function before I realized that :P

creds ...same as above.

Keywords

FAQs

Package last updated on 12 Sep 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