Socket
Socket
Sign inDemoInstall

@octokit/auth-oauth-device

Package Overview
Dependencies
Maintainers
3
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@octokit/auth-oauth-device

GitHub OAuth Device authentication strategy for JavaScript


Version published
Weekly downloads
1.2M
increased by6.88%
Maintainers
3
Weekly downloads
 
Created

What is @octokit/auth-oauth-device?

@octokit/auth-oauth-device is an npm package that provides OAuth device flow authentication for GitHub. It allows users to authenticate with GitHub using a device code, which is particularly useful for applications running on devices with limited input capabilities.

What are @octokit/auth-oauth-device's main functionalities?

Device Code Authentication

This feature allows you to authenticate a user via the OAuth device flow. The code sample demonstrates how to create an OAuth device authentication instance and use it to authenticate a user.

const { createOAuthDeviceAuth } = require('@octokit/auth-oauth-device');

const auth = createOAuthDeviceAuth({
  clientType: 'oauth-app',
  clientId: 'your-client-id',
  clientSecret: 'your-client-secret'
});

(async () => {
  const { authentication } = await auth({ type: 'oauth' });
  console.log(authentication);
})();

Generate Device Code

This feature generates a device code and provides the user with a URL and code to authenticate. The code sample shows how to generate the device code and display the verification URL and user code.

const { createOAuthDeviceAuth } = require('@octokit/auth-oauth-device');

const auth = createOAuthDeviceAuth({
  clientType: 'oauth-app',
  clientId: 'your-client-id',
  clientSecret: 'your-client-secret'
});

(async () => {
  const { device_code, user_code, verification_uri } = await auth({ type: 'oauth', onVerification: ({ device_code, user_code, verification_uri }) => {
    console.log(`Open ${verification_uri} and enter code: ${user_code}`);
  }});
})();

Other packages similar to @octokit/auth-oauth-device

Keywords

FAQs

Package last updated on 08 Jul 2022

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc