@openauth/youtube
TypeScript icon, indicating that this package has built-in type declarations

0.3.1 • Public • Published

Open Auth - Youtube

Downloads Version License Typescript dependencies Status

@openauth/youtube is an implementation of Youtube OAuth.

Installation

npm i @openauth/youtube

Usage

import { YoutubeOAuth } from '@openauth/youtube'

const oauth = new YoutubeOAuth({
  clientId: 'client_id',
  clientSecret: 'client_secret',
  redirectUri: 'https://wani.kr/auth/youtube/callback',
})


// 1. After getting auth request uri, connect.
const redirectUri = await oauth.getAuthRequestUri()

// 2. It redirects with the code, and replaces the access token with this code value.
const { accessToken } = await oauth.getAccessTokenResponse(code)

// 3. Get user profile.
await oauth.getAuthUser(accessToken)

// 4. Other API
await oauth.getClient(accessToken).get({
  path: 'youtube/v3/channels',
  query: {
    part: 'snippet',
    mine: 'true',
  },
})

Package Sidebar

Install

npm i @openauth/youtube

Weekly Downloads

0

Version

0.3.1

License

MIT

Unpacked Size

7.08 kB

Total Files

10

Last publish

Collaborators

  • wan2land