From bb20ce6b16924c192bdcba63ea61ade0cabf829e Mon Sep 17 00:00:00 2001 From: Charles Connell Date: Wed, 18 Dec 2013 18:10:56 -0500 Subject: [PATCH] Improve formatting --- docs/source/gdrive.rst | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/docs/source/gdrive.rst b/docs/source/gdrive.rst index 01de6ad..932eeca 100644 --- a/docs/source/gdrive.rst +++ b/docs/source/gdrive.rst @@ -7,29 +7,37 @@ But it happens infrequently enough that we haven't simplified the process. This should probably happen in the future, but in the meantime we can document the process. -Start a django interactive shell -Import the `karmaworld.apps.notes.gdrive` module. -build a flow object called `flow` -open a private browsing instance in a browser -Log into the google drive account of the GOOGLE_USER set in `karmaworld.secrets.drive` -get the authorization url +* Start a django interactive shell +* Import the `karmaworld.apps.notes.gdrive` module. +* build a flow object called `flow` +* open a private browsing instance in a browser +* Log into the google drive account of the GOOGLE_USER set in `karmaworld.secrets.drive` +* get the authorization url + flow.step1_get_authorize_url() -go to that url in your browser -it will redirecto you to a url in the format of: +* go to that url in your browser +* it will redirecto you to a url in the format of: + http://localhost:8000/oauth2callback?code=EXCHANGE_CODE The url of the page you are re-directed to will contain the EXCHANGE_CODE required to complete the authentication take the EXCHANGE_CODE from the url, and feed it as a string to + credentials = flow.step2_exchange('EXCHANGE_CODE') This gives you a credentials object, keep this value + Create an instance of DriveAuth() + from karmaworld.apps.notes.models import DriveAuth auth = DriveAuth() + and feed the credentials object to it with store() + auth.store(credentials) + This will save the DriveAuth() You are now authenticated! -- 2.25.1