Using OAuth 2.0 for Installed Applications에 설명 된 단계에 따라 애플리케이션 용 인증 코드를 얻을 수있었습니다. 응용 프로그램 만 사용 (새로운 access_token이를 얻기 위해 필요하므로, http://image.prntscr.com/image/bcda26f2ee12463e80e4fdd9401380da.pngGoogle API OAuth2 - 승인 토큰에서 새로 고침 토큰 가져 오기
나는 "기타"형식을 사용하고 있습니다 :
은 내가 Google 개발자 콘솔에서의 OAuth 2.0 클라이언트 ID로 내 응용 프로그램을 등록 refresh_token), 사용자 동의 유형을 사용하지 않습니다.
개인 응용 프로그램이므로 보안은 중요하지 않습니다.
스프레드 시트에 읽고 쓰고 해당 스프레드 시트에 연결된 Google Apps 스크립트를 실행할 수 있어야합니다.
이
은 Google's OAuth 2.0 Playground에 따라, 범위 " https://www.googleapis.com/auth/spreadsheets"내의 모든 수 있습니다 : 나는 다음과 같은 요청을 사용하여 인증 코드 내 손에 얻을 수 있었다http://image.prntscr.com/image/a506d2095be1472aa1807a52b01ab1f1.png
(this 단계 다음) :
: 브라우저에서https://accounts.google.com/o/oauth2/v2/auth?
scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fspreadsheets&
redirect_uri=urn:ietf:wg:oauth:2.0:oob&
response_type=code&
client_id=#####.apps.googleusercontent.com
붙여 넣기 URL을,이 페이지로 나를 리디렉션
http://image.prntscr.com/image/64ccfc9a63be4cb985163c0e3ba0c8ef.png
I 은, 이론적으로, refresh_token도하고 access_token은 교환 할 수있는 인증 코드를 얻은이 방법.
내가 요청을 흉내 낸 시도 구글의 OAuth는 2.0 refresh_token도에 대한 인증 코드와 access_token은 교환 할 때 운동장을 수행합니다
https://www.googleapis.com/oauth2/v3/token?
code={auth_code}&
redirect_uri=https%3A%2F%2Fdevelopers.google.com%2Foauthplayground&
client_id=#####.apps.googleusercontent.com&
client_secret=#####&
scope=&
grant_type=authorization_code
:
http://image.prntscr.com/image/54e7e7da18f044c3a86e2a05b51ba830.png
그것은 다음과 같은 URL에 POST 요청을 보냅니다
이 요청을 시도하면 다음 응답으로 오류 400이 표시됩니다.
{"error": "invalid_request", "error_description": "Invalid parameter value for redirect_uri: Missing scheme: {redirect_uri}}
redirect_uri에 대해 "누락 된 구성표"에 대한 오류가 발생합니다. 내 응용 프로그램 유형이 "기타"이고 은 해당 유형의 리디렉션 URI을 인증 할 수 없기 때문에 이것은 이상한 것이 아닙니다.
내가 시도했던 OAuth2ForDevices (정확히 내가 원하는 인),하지만 난 구글의 스프레드 시트가 사용할 수 없습니다.
Google 스프레드 시트에 사용할 수있는 클라이언트 ID 유형 "기타"를 통해 획득 한 인증 코드를 사용하여 refresh_token (및 access_token)을 얻는 올바른 방법은 무엇입니까?