Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
* Import wiki pages
* Update README (including upgrade instructions)
  • Loading branch information
astrada committed Jul 15, 2012
1 parent 480d057 commit c49b354
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Expand Up @@ -90,3 +90,14 @@ and check for changes only every 60 seconds (configurable). So if you make a
change to your documents, you won't see it immediately in the mounted
filesystem.

### Upgrading from 0.1pre2

Since version 0.1pre3, the application uses Drive API v2, instead of Google
Documents List API v3, so if you are upgrading from previous versions, you
should clean every file in `~/.gdfuse/default`:

$ rm -rf ~/.gdfuse/default

because the access token requested previously is not compatible with the new
API.

60 changes: 60 additions & 0 deletions doc/Authorization.md
@@ -0,0 +1,60 @@
### Standard authorization mode

Authorization is provided by a Google App Engine service (the source code of
the service is [here](https://github.com/astrada/gd-ocaml-auth)). When you
start the program without specifying a mountpoint,

$ google-drive-ocamlfuse

the executable opens a web browser (using `xdg-open`, or, if `xdg-open` is not
available, launching `firefox` or `google-chrome`), showing a page that will
ask you to authorize access to your Google Drive. If you allow it, the Google
authorization endpoint will connect to the GAE service, providing a
verification code, that will be exchanged for an access token and a refresh
token (for offline access). Meanwhile, `google-drive-ocamlfuse` polls the GAE
service, asking for tokens, until it gets them, or there is an error, or a
timeout triggers. If anything goes wrong, you can safely restart the
application, and it will try to recover. If it cannot recover, you should
clean the content of `~/.gdfuse/default` to start from scratch. Otherwise, if
the application can retrieve the tokens, the program will exit and you may
then mount the Google Drive filesystem. `google-drive-ocamlfuse` will also use
the GAE service when it needs to refresh the access token (access tokens
usually are valid for 60 minutes). The GAE service has two purposes: to make
the authorization process simpler (removing all manual steps), and to avoid
exposing the OAuth2 client secret of the application (otherwise anyone can
impersonate it).

### Alternative authorization mode

If you don't trust the GAE service, there is an alternative way to authorize
the application, that doesn't involve external services. If you have your own
OAuth2 client ID and client secret, you may pass them on the command line (the
first time you issue the application), e.g.:

$ google-drive-ocamlfuse -client_id 12345678.apps.googleusercontent.com -client_secret abcde12345

This way, the application will use your credentials, and will not connect to
the GAE service. A browser will be started pointing to an authorization page,
and when you allow access to Google Drive, a verification code will be
generated. You have to copy this verification code, and paste it in the
console where the application is running.

Please enter the verification code: 1/12309afhaskfhlskhfklsfslkhfskhfskskdfh

If everything goes fine, the application will notify you that it has retrieved
the tokens from Google.

Access token retrieved correctly.

You can create OAuth2 credentials from the Google APIs Console.
[Here](https://developers.google.com/console/help/#creatingdeletingprojects)
you can find how to create a new application and how to set up OAuth 2.0
credentials. When creating a new client ID, you must select "Installed
applications" as Application type and "Other" as Installed application type
(Redirect URI should be `urn:ietf:wg:oauth:2.0:oob`).

### Revoking access

Anyway, you can always revoke access to Google Drive from
[here](https://accounts.google.com/b/0/IssuedAuthSubTokens).

56 changes: 56 additions & 0 deletions doc/Configuration.md
@@ -0,0 +1,56 @@
The configuration file is saved in `~/.gdfuse/default/config` (or `~/.gdfuse/label/config` if a label was specified on the command line). The parser is very simple and only accepts lines in the form `key=value`, without spaces, comments, or anything else.

### Content

Specifies if debug mode is turned on: if `true`, logs verbose output to `~/.gdfuse/default/gdfuse.log`, and logs every curl request to `~/.gdfuse/default/curl.log`:

debug=true

Specifies the interval in seconds between queries to detect server-side changes:

metadata_cache_time=60

Specifies if the filesystem is to be mounted read-only (at this moment, write support is not yet implemented):

read_only=true

Specifies the umask (i.e. the bitmask of the permissions that are not present) mount option:

umask=0o002

Specifies the Sqlite3 busy handler timeout in milliseconds:

sqlite3_busy_timeout=500

Specifies whether to download Google Docs (these files are read-only, even if `read_only=false`):

download_docs=true

Text document [export format](https://developers.google.com/google-apps/documents-list/#valid_download_formats_for_text_documents):

document_format=odt

Drawings [export format](https://developers.google.com/google-apps/documents-list/#valid_download_formats_for_drawings):

drawing_format=png

Forms [export format](https://developers.google.com/google-apps/documents-list/#valid_formats_for_spreadsheets):

form_format=ods

Presentations [export format](https://developers.google.com/google-apps/documents-list/#valid_formats_for_presentations):

presentation_format=pdf

Spreadsheets [export format](https://developers.google.com/google-apps/documents-list/#valid_formats_for_spreadsheets):

spreadsheet_format=ods

OAuth2 client ID (optional)

client_id=

OAuth2 client secret (optional)

client_secret=

4 changes: 4 additions & 0 deletions doc/Home.md
@@ -0,0 +1,4 @@
Welcome to the google-drive-ocamlfuse wiki!

* [[Authorization]]
* [[Configuration]]

0 comments on commit c49b354

Please sign in to comment.