OAuth naver library.

Usage no npm install needed!

<script type="module">
  import openauthNaver from 'https://cdn.skypack.dev/@openauth/naver';


Open Auth - Naver

Downloads Version License Typescript dependencies Status

@openauth/naver is an implementation of Naver OAuth.


npm i @openauth/naver


import { NaverOAuth } from '@openauth/naver'

const oauth = new NaverOAuth({
  clientId: 'client_id',
  clientSecret: 'client_secret',
  redirectUri: 'https://wani.kr/auth/naver/callback',

OAuth login link.

oauth.getAuthRequestUri() // print https://nid.naver.com/oauth2.0/authorize?...

After logging in, you will be redirected to the redirectUri page with the code value.

const code = 'AQAO3q3...'

const response = await oauth.getAccessTokenResponse(code)
console.log(response) // { accessToken: '...', refreshToken: '...', tokenType: 'bearer', expiresIn: 3600 }

Save accessToken and use it when requesting API.

const user = await oauth.getAuthUser(response.accessToken)
console.log(user) // { id: '3000000', email: '...', name: '...' }