Difference between revisions of "Managing GDrive Access"

From UFRC
Jump to navigation Jump to search
 
Line 6: Line 6:
 
  $ module load gdrive/2.1.0
 
  $ module load gdrive/2.1.0
 
  $ gdrive about
 
  $ gdrive about
 
 
* If authentication is needed (e.g. it is your first time using the module or your prior authentication has expired), you will then get the following prompt:
 
* If authentication is needed (e.g. it is your first time using the module or your prior authentication has expired), you will then get the following prompt:
 
  Authentication needed
 
  Authentication needed
Line 12: Line 11:
 
  https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=...
 
  https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=...
 
  Enter verification code:
 
  Enter verification code:
 
+
* The URL in the example above is truncated to make these instructions easier to read. The actual URL you will see on your screen is much longer.  '''Make sure you select and copy all of it.'''
{{ note|The URL in the example above is truncated to make these instructions easier to read. The actual URL you will see on your screen is much longer.  '''Make sure you select and copy all of it.'''}}
 
 
 
 
* Copy and paste the supplied URL into a browser on your desktop, and log into your '''UF Google account''' using your '''UF credentials'''.
 
* Copy and paste the supplied URL into a browser on your desktop, and log into your '''UF Google account''' using your '''UF credentials'''.
 
 
* You will then be prompted that "project-367116221053 wants to access your Google Account...See, edit, create, and delete all of your Google Drive files".  Read the note below and, if you are comfortable with this, click [Allow].
 
* You will then be prompted that "project-367116221053 wants to access your Google Account...See, edit, create, and delete all of your Google Drive files".  Read the note below and, if you are comfortable with this, click [Allow].
  
 
{{ note|"project-367116221053" is the name that the developer of the "gdrive" software () provided to Google when registering the application for review and acceptance, and must be kept to be recognized. When you click the [Allow] button, you agree to "allow gdrive3 that is running on HiPerGator to access my Google Drive (as long as it has a valid token)".}}
 
{{ note|"project-367116221053" is the name that the developer of the "gdrive" software () provided to Google when registering the application for review and acceptance, and must be kept to be recognized. When you click the [Allow] button, you agree to "allow gdrive3 that is running on HiPerGator to access my Google Drive (as long as it has a valid token)".}}
 
 
* After allowing permissions, you will be taken to a page with an authorization code on it.  Copy that code and paste it back in your HiPerGator session where it is waiting at the "'''Enter verification code:'''" prompt.
 
* After allowing permissions, you will be taken to a page with an authorization code on it.  Copy that code and paste it back in your HiPerGator session where it is waiting at the "'''Enter verification code:'''" prompt.
 
 
* You should now be able you access your Google drive using gdrive commands (i.e. try "gdrive list" to show the files currently in your Google Drive).
 
* You should now be able you access your Google drive using gdrive commands (i.e. try "gdrive list" to show the files currently in your Google Drive).
 
 
{{note|This process will have created a sub-directory in your home directory called ".gdrive".  The contents of the ".gdrive" directory contain information allowing direct access to your Google Drive and should be considered secret.  Do not share or change the permissions of the directory or its contents.|warn}}
 
{{note|This process will have created a sub-directory in your home directory called ".gdrive".  The contents of the ".gdrive" directory contain information allowing direct access to your Google Drive and should be considered secret.  Do not share or change the permissions of the directory or its contents.|warn}}
  

Latest revision as of 14:06, 16 March 2023

Back to GDrive

Initial authentication and authorization

Before using GDrive from the HiPerGator environment, you must give it permission to access your Googe Drive. Do that by following the steps below.

  • Load the module and then initiate authentication using "gdrive about":
$ module load gdrive/2.1.0
$ gdrive about
  • If authentication is needed (e.g. it is your first time using the module or your prior authentication has expired), you will then get the following prompt:
Authentication needed
Go to the following url in your browser:
https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=...
Enter verification code:
  • The URL in the example above is truncated to make these instructions easier to read. The actual URL you will see on your screen is much longer. Make sure you select and copy all of it.
  • Copy and paste the supplied URL into a browser on your desktop, and log into your UF Google account using your UF credentials.
  • You will then be prompted that "project-367116221053 wants to access your Google Account...See, edit, create, and delete all of your Google Drive files". Read the note below and, if you are comfortable with this, click [Allow].
"project-367116221053" is the name that the developer of the "gdrive" software () provided to Google when registering the application for review and acceptance, and must be kept to be recognized. When you click the [Allow] button, you agree to "allow gdrive3 that is running on HiPerGator to access my Google Drive (as long as it has a valid token)".
  • After allowing permissions, you will be taken to a page with an authorization code on it. Copy that code and paste it back in your HiPerGator session where it is waiting at the "Enter verification code:" prompt.
  • You should now be able you access your Google drive using gdrive commands (i.e. try "gdrive list" to show the files currently in your Google Drive).
This process will have created a sub-directory in your home directory called ".gdrive". The contents of the ".gdrive" directory contain information allowing direct access to your Google Drive and should be considered secret. Do not share or change the permissions of the directory or its contents.

Revoking Access

The contents of the ".gdrive" directory contain information allowing direct access to your Google Drive and should be considered secret. Do not share or change the permissions of the directory or its contents.

When you perform the initial authentication and authorization steps above, the program creates access tokens in your home directory as:

/home/yourusername/.gdrive/

You can immediately revoke access at any time by removing that directory:

rm -rf /home/yourusername/.gdrive/