google drive API v3 사용

Posted by HULIA(휴리아)
2021. 2. 22. 23:51 백엔드개발/NODEJS

Google Drive API  |  Google Developers

 

Google Drive API  |  Google Developers

Create an app that reads, writes, and syncs files in Google Drive.

developers.google.com

Introduction to Google Drive API  |  Google Developers

 

Introduction to Google Drive API  |  Google Developers

The Drive REST API lets you create web apps that access files stored in Google Drive.

developers.google.com

0)전제조건

1)구글 drive API 켜기

구글 API를 사용하기 위해서는 OAuth Client(Application)를 만들어야 한다

만들고 나면은 최종 화면에서 DOWNLOAD CLIENT COFIGURATION 버튼을 클릭하여서 credentials.json파일을 다운 받아서 내가 만든 node.js 어플리케이션에 복사함

Google API Console

 

Google Cloud Platform

하나의 계정으로 모든 Google 서비스를 Google Cloud Platform을 사용하려면 로그인하세요.

accounts.google.com

2)googleapi 라이브러리 설치

3)index.js 생성하기

node-samples/index.js at master · googleworkspace/node-samples · GitHub

 

googleworkspace/node-samples

Node samples for Google Workspace APIs. Contribute to googleworkspace/node-samples development by creating an account on GitHub.

github.com

4)node index.js으로 quickstart 앱과 연동하기(최초 1번)

URL을 복사해서 웹브라우저 입력하면은

고급을 눌러 이동합니다

그럼 권한부여화면에서 허용을 눌러줍니다

그리고는 마지막에 나오는 코드를 입력해주면 정상적으로 token.json이 만들어 지게 됩니다~

5)node index.js 실행하기