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

@octokit/auth-oauth-user

Package Overview
Dependencies
Maintainers
4
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@octokit/auth-oauth-user

Octokit authentication strategy for OAuth clients

  • 5.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created

What is @octokit/auth-oauth-user?

@octokit/auth-oauth-user is an npm package that provides OAuth user authentication for GitHub. It allows developers to authenticate users via OAuth and perform actions on behalf of the authenticated user.

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

OAuth User Authentication

This feature allows you to authenticate a user via OAuth by providing the client ID, client secret, and authorization code. The code sample demonstrates how to obtain an OAuth token for the authenticated user.

const { createOAuthUserAuth } = require('@octokit/auth-oauth-user');

const auth = createOAuthUserAuth({
  clientId: 'your-client-id',
  clientSecret: 'your-client-secret',
  code: 'authorization-code'
});

(async () => {
  const { token } = await auth();
  console.log('OAuth Token:', token);
})();

Token Authentication

This feature allows you to authenticate a user using an existing access token. The code sample demonstrates how to authenticate and retrieve the token.

const { createOAuthUserAuth } = require('@octokit/auth-oauth-user');

const auth = createOAuthUserAuth({
  clientId: 'your-client-id',
  clientSecret: 'your-client-secret',
  token: 'user-access-token'
});

(async () => {
  const { token } = await auth();
  console.log('Authenticated Token:', token);
})();

Refresh Token

This feature allows you to refresh an OAuth token using a refresh token. The code sample demonstrates how to obtain a new access token using a refresh token.

const { createOAuthUserAuth } = require('@octokit/auth-oauth-user');

const auth = createOAuthUserAuth({
  clientId: 'your-client-id',
  clientSecret: 'your-client-secret',
  refreshToken: 'user-refresh-token'
});

(async () => {
  const { token } = await auth();
  console.log('Refreshed Token:', token);
})();

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

Keywords

FAQs

Package last updated on 25 Feb 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