Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@octokit/auth-oauth-device

Package Overview
Dependencies
Maintainers
4
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

  • 7.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
969K
decreased by-17.34%
Maintainers
4
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 16 Apr 2024

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