안녕하세요? 시놀에서 rclone을 이용해 Google Drive를 연결해 잘 쓰고 있습니다.
rclone 버전은 1.57로 1년째 잘쓰고 있었는데 갑자기 토큰이 expire 또는 revoke 됐다고 연결이 끊어져 버렸습니다.
그래서 rclone 최신 버전인 1.58.1로 버전을 올리고 기존에 있던 remote를 삭제 후 다시 생성을 하려는데
마지막단의 구글 인증이 되질 않고 있습니다.
아래에서 "N"을 누르면 인증을 하는 경로가 나오고 브라우저에 붙여서 인증을 하는것으로 알고 있는데
인증하는 주소가 나오질 않고 config_token을 넣어라고만 나오고 있습니다.
어떻게 인증을 할 수 있을까요?
Use auto config?
* Say Y if not sure
* Say N if you are working on a remote or headless machine
y) Yes (default)
n) No
y/n> n
Option config_token.
For this to work, you will need rclone available on a machine that has
a web browser available.
For more help and alternate methods see: https://rclone.org/remote_setup/
Execute the following on the machine with the web browser (same rclone
version recommended):
rclone authorize "drive" "***********************************************"
Then paste the result.
Enter a value.
config_token>
------ 전체 ---------------------------------------------------------------------------------------------------------------------------
name> GD
Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.
......
17 / Google Drive
\ (drive)
......
Storage> 17
Option client_id.
Google Application Client Id
Setting your own is recommended.
See https://rclone.org/drive/#making-your-own-client-id for how to create your own.
If you leave this blank, it will use an internal key which is low performance.
Enter a value. Press Enter to leave empty.
client_id> ********
Option client_secret.
OAuth Client Secret.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_secret> *******
Option scope.
Scope that rclone should use when requesting access from drive.
Choose a number from below, or type in your own value.
Press Enter to leave empty.
1 / Full access all files, excluding Application Data Folder.
\ (drive)
2 / Read-only access to file metadata and file contents.
\ (drive.readonly)
/ Access to files created by rclone only.
3 | These are visible in the drive website.
| File authorization is revoked when the user deauthorizes the app.
\ (drive.file)
/ Allows read and write access to the Application Data folder.
4 | This is not visible in the drive website.
\ (drive.appfolder)
/ Allows read-only access to file metadata but
5 | does not allow any access to read or download file content.
\ (drive.metadata.readonly)
scope> 1
Option root_folder_id.
ID of the root folder.
Leave blank normally.
Fill in to access "Computers" folders (see docs), or for rclone to use
a non root folder as its starting point.
Enter a value. Press Enter to leave empty.
root_folder_id>
Option service_account_file.
Service Account Credentials JSON file path.
Leave blank normally.
Needed only if you want use SA instead of interactive login.
Leading `~` will be expanded in the file name as will environment variables such as `${RCLONE_CONFIG_DIR}`.
Enter a value. Press Enter to leave empty.
service_account_file>
Edit advanced config?
y) Yes
n) No (default)
y/n> n
Use auto config?
* Say Y if not sure
* Say N if you are working on a remote or headless machine
y) Yes (default)
n) No
y/n> n
Option config_token.
For this to work, you will need rclone available on a machine that has
a web browser available.
For more help and alternate methods see: https://rclone.org/remote_setup/
Execute the following on the machine with the web browser (same rclone
version recommended):
rclone authorize "drive" "***********************************************"
Then paste the result.
Enter a value.
config_token>
-------------------------------------해결방안----------------------------------------------------------
1. Rclone 1.58.1 부터는 인증방식이 변경 되었습니다.
2. Use Auto Config (N)을 하면 예전에는 인증주소가 나왔는데 1.58.1 부터는 외부클라이언트에서 별도 인증을 해줘야 합니다.
Use Auto Config (N)을 선택하면 인증시 필요한 명령어가 안내 됩니다... (rclone authorize "drive" "***********************************************")
3. 일단 윈도우용 Rclone을 따로 설치하고 여기에 위 설치 된 Rclone 경로에서 rclone authorize "drive" "***********************************************" 를 실행 합니다.
4. 그러면 웹브라우저 팝업으로 인증창이 나오는데 아래 오류가 나서 진행이 되질 않으실 겁니다.
"승인 오류
400 오류: invalid_request
Localhost URI is not allowed for 'NATIVE_DEVICE' client type. "
5. 이 오류를 해결하기 위해서는 Google API에 Redirect URI가 설정되어야 합니다.
인터넷에서 Google API의 OAuth 클라이언트 ID 생성 시 애플리케이션 유형을 보통 "TV 및 입력제한기기"로 하셨을텐데
이 부분을 "웹애플리케이션"으로 바꿔주고, 밑에 있는 승인된 리디렉션 URI 항목에 "http://127.0.0.1:536821"을
추가해 주셔야 합니다.
6. 위 설정이 완료 되고 윈도우에서 rclone authorize "drive" "***********************************************"를
실행하고 정상적으로 인증창이 나오고 인증이 완료되면, 윈도우 CMD 화면에 코드값이 나옵니다.
7. 이 코드값을 설정하고 있는 NAS 인증쪽에 있는 config_token 프롬프트에 붙여주시고 다음단계를 진행하시면 끝 입니다.
이걸하면 Use auto config?에서 y 한것과 같은 http://127.0.0.1:53682/로 인증하라고 나오는데
이 주소를 넣으면 "127.0.0.1에서 연결을 거부했습니다"라는 메시지가 나옵니다. 방법이 있을까요?
2022/06/22 09:37:27 NOTICE: Make sure your Redirect URL is set to "http://127.0.0.1:53682/" in your custom config.
2022/06/22 09:37:27 NOTICE: If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=*******************
2022/06/22 09:37:27 NOTICE: Log in and authorize rclone for access
2022/06/22 09:37:27 NOTICE: Waiting for code...
For this to work, you will need rclone available on a machine that has a web browser available.
For more help and alternate methods see: https://rclone.org/remote_setup/
Execute the following on the machine with the web browser (same rclone version recommended):
이 메세지만 잘 보고 따라하면 쉽게 되는지라 오전에 바빠서 간단하게만 답변 달았는데 다행히 잘 해결하셨네요 ㅎㅎ
/Vollago
y하면 이렇게 나오는데요.... 이후 어떻게 인증해야 하나요????
http://127.0.0.1:53682/auth?state=********** 주소 들어가면 연결 거부 메세지 나옵니다.
커스텀 config에서 리다이렉트 URL을 "http://127.0.0.1:53682/"로 설정하라는 것 같은데 어떻게 할지 모르겠습니다.
2022/06/22 09:48:33 NOTICE: Make sure your Redirect URL is set to "http://127.0.0.1:53682/" in your custom config.
2022/06/22 09:48:33 NOTICE: If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=**********
2022/06/22 09:48:33 NOTICE: Log in and authorize rclone for access
2022/06/22 09:48:33 NOTICE: Waiting for code...
/Vollago
그리고 그 conf 파일만 나스에 넣어줬어요.
*다른방법은 127.0.0.1에 노출 되는 포트 임시로 열서어 접근 하셔도 됩니다
위에 다시 설명하겠습니다...
rclone authorize "drive" "***********************************************"
입력하고 브라우저 통해 인증, 인증 후 rclone token 코드 복사
시놀 rclone config 구글 드라이브 연동 시 해당 토큰 코드 입력하면 됩니다.
위에 다시 설명하겠습니다...
바로 사용하지 않는 머신에서 새로 생성해서 해봐야 하겠습니다.
PC에서 nas로 ssh 터널 접속 후 pc에서 웹브라우저로 http://127.0.0.1:53682 주소로 접속하면 됩니다.
ssh -L 53682:127.0.0.1:53682 nas_id@nas_ip