forked from platypush/platypush
[Google] Updated documentation of Google plugins.
Expanded explanation of the desktop vs. headless authentication process and where the credential files are supposed to be copied if the user opts for a non-automatic authentication flow.
This commit is contained in:
parent
dec2a54740
commit
31de917631
5 changed files with 142 additions and 37 deletions
|
@ -29,16 +29,37 @@ class GooglePlugin(Plugin):
|
||||||
5 Select "Desktop app", enter whichever name you like, and click "Create".
|
5 Select "Desktop app", enter whichever name you like, and click "Create".
|
||||||
|
|
||||||
6. Click on the "Download JSON" icon next to your newly created client ID.
|
6. Click on the "Download JSON" icon next to your newly created client ID.
|
||||||
|
Save the JSON file under
|
||||||
|
``<WORKDIR>/credentials/google/client_secret.json``.
|
||||||
|
|
||||||
7. Generate a credentials file for the required scope:
|
7.1. If you're running the service on a desktop environment, then you
|
||||||
|
can just start the application. A browser window will open and
|
||||||
|
you'll be asked to authorize the application - you may be prompted
|
||||||
|
with a warning because you are running a personal and potentially
|
||||||
|
unverified application. After authorizing the application, the
|
||||||
|
process will save the credentials under
|
||||||
|
``<WORKDIR>/credentials/google/<list,of,scopes>.json`` and proceed
|
||||||
|
with the plugin initialization.
|
||||||
|
|
||||||
|
7.2. If you're running the service on a headless environment, or you
|
||||||
|
prefer to manually generate the credentials file before copying to
|
||||||
|
another machine, you can run the following command:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
mkdir -p <WORKDIR>/credentials/google
|
mkdir -p <WORKDIR>/credentials/google
|
||||||
python -m platypush.plugins.google.credentials \
|
python -m platypush.plugins.google.credentials \
|
||||||
'calendar.readonly' \
|
'calendar.readonly,gmail.modify' \
|
||||||
|
[--noauth_local_webserver] \
|
||||||
<WORKDIR>/credentials/google/client_secret.json
|
<WORKDIR>/credentials/google/client_secret.json
|
||||||
|
|
||||||
|
When launched with ``--noauth_local_webserver``, the script will
|
||||||
|
start a local webserver and print a URL that should be opened in
|
||||||
|
your browser. After authorizing the application, you may be
|
||||||
|
prompted with a code that you should copy and paste back to the
|
||||||
|
script. Otherwise, if you're running the script on a desktop, a
|
||||||
|
browser window will be opened automatically.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|
|
@ -28,16 +28,37 @@ class GoogleCalendarPlugin(GooglePlugin, CalendarInterface):
|
||||||
5 Select "Desktop app", enter whichever name you like, and click "Create".
|
5 Select "Desktop app", enter whichever name you like, and click "Create".
|
||||||
|
|
||||||
6. Click on the "Download JSON" icon next to your newly created client ID.
|
6. Click on the "Download JSON" icon next to your newly created client ID.
|
||||||
|
Save the JSON file under
|
||||||
|
``<WORKDIR>/credentials/google/client_secret.json``.
|
||||||
|
|
||||||
7. Generate a credentials file for the required scope:
|
7.1. If you're running the service on a desktop environment, then you
|
||||||
|
can just start the application. A browser window will open and
|
||||||
|
you'll be asked to authorize the application - you may be prompted
|
||||||
|
with a warning because you are running a personal and potentially
|
||||||
|
unverified application. After authorizing the application, the
|
||||||
|
process will save the credentials under
|
||||||
|
``<WORKDIR>/credentials/google/<list,of,scopes>.json`` and proceed
|
||||||
|
with the plugin initialization.
|
||||||
|
|
||||||
|
7.2. If you're running the service on a headless environment, or you
|
||||||
|
prefer to manually generate the credentials file before copying to
|
||||||
|
another machine, you can run the following command:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
mkdir -p <WORKDIR>/credentials/google
|
mkdir -p <WORKDIR>/credentials/google
|
||||||
python -m platypush.plugins.google.credentials \
|
python -m platypush.plugins.google.credentials \
|
||||||
'calendar.readonly' \
|
'calendar.readonly' \
|
||||||
|
[--noauth_local_webserver] \
|
||||||
<WORKDIR>/credentials/google/client_secret.json
|
<WORKDIR>/credentials/google/client_secret.json
|
||||||
|
|
||||||
|
When launched with ``--noauth_local_webserver``, the script will
|
||||||
|
start a local webserver and print a URL that should be opened in
|
||||||
|
your browser. After authorizing the application, you may be
|
||||||
|
prompted with a code that you should copy and paste back to the
|
||||||
|
script. Otherwise, if you're running the script on a desktop, a
|
||||||
|
browser window will be opened automatically.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
scopes = ['calendar.readonly']
|
scopes = ['calendar.readonly']
|
||||||
|
|
|
@ -28,16 +28,37 @@ class GoogleDrivePlugin(GooglePlugin):
|
||||||
5 Select "Desktop app", enter whichever name you like, and click "Create".
|
5 Select "Desktop app", enter whichever name you like, and click "Create".
|
||||||
|
|
||||||
6. Click on the "Download JSON" icon next to your newly created client ID.
|
6. Click on the "Download JSON" icon next to your newly created client ID.
|
||||||
|
Save the JSON file under
|
||||||
|
``<WORKDIR>/credentials/google/client_secret.json``.
|
||||||
|
|
||||||
7. Generate a credentials file for the required scope:
|
7.1. If you're running the service on a desktop environment, then you
|
||||||
|
can just start the application. A browser window will open and
|
||||||
|
you'll be asked to authorize the application - you may be prompted
|
||||||
|
with a warning because you are running a personal and potentially
|
||||||
|
unverified application. After authorizing the application, the
|
||||||
|
process will save the credentials under
|
||||||
|
``<WORKDIR>/credentials/google/<list,of,scopes>.json`` and proceed
|
||||||
|
with the plugin initialization.
|
||||||
|
|
||||||
|
7.2. If you're running the service on a headless environment, or you
|
||||||
|
prefer to manually generate the credentials file before copying to
|
||||||
|
another machine, you can run the following command:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
mkdir -p <WORKDIR>/credentials/google
|
mkdir -p <WORKDIR>/credentials/google
|
||||||
python -m platypush.plugins.google.credentials \
|
python -m platypush.plugins.google.credentials \
|
||||||
'drive,drive.appfolder,drive.photos.readonly' \
|
'drive,drive.appfolder,drive.photos.readonly' \
|
||||||
|
[--noauth_local_webserver] \
|
||||||
<WORKDIR>/credentials/google/client_secret.json
|
<WORKDIR>/credentials/google/client_secret.json
|
||||||
|
|
||||||
|
When launched with ``--noauth_local_webserver``, the script will
|
||||||
|
start a local webserver and print a URL that should be opened in
|
||||||
|
your browser. After authorizing the application, you may be
|
||||||
|
prompted with a code that you should copy and paste back to the
|
||||||
|
script. Otherwise, if you're running the script on a desktop, a
|
||||||
|
browser window will be opened automatically.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
scopes = [
|
scopes = [
|
||||||
|
|
|
@ -25,8 +25,21 @@ class GoogleFitPlugin(GooglePlugin):
|
||||||
5 Select "Desktop app", enter whichever name you like, and click "Create".
|
5 Select "Desktop app", enter whichever name you like, and click "Create".
|
||||||
|
|
||||||
6. Click on the "Download JSON" icon next to your newly created client ID.
|
6. Click on the "Download JSON" icon next to your newly created client ID.
|
||||||
|
Save the JSON file under
|
||||||
|
``<WORKDIR>/credentials/google/client_secret.json``.
|
||||||
|
|
||||||
7. Generate a credentials file for the required scope:
|
7.1. If you're running the service on a desktop environment, then you
|
||||||
|
can just start the application. A browser window will open and
|
||||||
|
you'll be asked to authorize the application - you may be prompted
|
||||||
|
with a warning because you are running a personal and potentially
|
||||||
|
unverified application. After authorizing the application, the
|
||||||
|
process will save the credentials under
|
||||||
|
``<WORKDIR>/credentials/google/<list,of,scopes>.json`` and proceed
|
||||||
|
with the plugin initialization.
|
||||||
|
|
||||||
|
7.2. If you're running the service on a headless environment, or you
|
||||||
|
prefer to manually generate the credentials file before copying to
|
||||||
|
another machine, you can run the following command:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
|
@ -40,8 +53,16 @@ class GoogleFitPlugin(GooglePlugin):
|
||||||
fitness.location.read
|
fitness.location.read
|
||||||
"
|
"
|
||||||
$ python -m platypush.plugins.google.credentials "$roles" \
|
$ python -m platypush.plugins.google.credentials "$roles" \
|
||||||
|
[--noauth_local_webserver] \
|
||||||
<WORKDIR>/credentials/google/client_secret.json
|
<WORKDIR>/credentials/google/client_secret.json
|
||||||
|
|
||||||
|
When launched with ``--noauth_local_webserver``, the script will
|
||||||
|
start a local webserver and print a URL that should be opened in
|
||||||
|
your browser. After authorizing the application, you may be
|
||||||
|
prompted with a code that you should copy and paste back to the
|
||||||
|
script. Otherwise, if you're running the script on a desktop, a
|
||||||
|
browser window will be opened automatically.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
scopes = [
|
scopes = [
|
||||||
|
|
|
@ -37,16 +37,37 @@ class GoogleMailPlugin(GooglePlugin):
|
||||||
5 Select "Desktop app", enter whichever name you like, and click "Create".
|
5 Select "Desktop app", enter whichever name you like, and click "Create".
|
||||||
|
|
||||||
6. Click on the "Download JSON" icon next to your newly created client ID.
|
6. Click on the "Download JSON" icon next to your newly created client ID.
|
||||||
|
Save the JSON file under
|
||||||
|
``<WORKDIR>/credentials/google/client_secret.json``.
|
||||||
|
|
||||||
7. Generate a credentials file for the required scope:
|
7.1. If you're running the service on a desktop environment, then you
|
||||||
|
can just start the application. A browser window will open and
|
||||||
|
you'll be asked to authorize the application - you may be prompted
|
||||||
|
with a warning because you are running a personal and potentially
|
||||||
|
unverified application. After authorizing the application, the
|
||||||
|
process will save the credentials under
|
||||||
|
``<WORKDIR>/credentials/google/<list,of,scopes>.json`` and proceed
|
||||||
|
with the plugin initialization.
|
||||||
|
|
||||||
|
7.2. If you're running the service on a headless environment, or you
|
||||||
|
prefer to manually generate the credentials file before copying to
|
||||||
|
another machine, you can run the following command:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
mkdir -p <WORKDIR>/credentials/google
|
mkdir -p <WORKDIR>/credentials/google
|
||||||
python -m platypush.plugins.google.credentials \
|
python -m platypush.plugins.google.credentials \
|
||||||
'gmail.modify' \
|
'gmail.modify' \
|
||||||
|
[--noauth_local_webserver] \
|
||||||
<WORKDIR>/credentials/google/client_secret.json
|
<WORKDIR>/credentials/google/client_secret.json
|
||||||
|
|
||||||
|
When launched with ``--noauth_local_webserver``, the script will
|
||||||
|
start a local webserver and print a URL that should be opened in
|
||||||
|
your browser. After authorizing the application, you may be
|
||||||
|
prompted with a code that you should copy and paste back to the
|
||||||
|
script. Otherwise, if you're running the script on a desktop, a
|
||||||
|
browser window will be opened automatically.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
scopes = ['https://www.googleapis.com/auth/gmail.modify']
|
scopes = ['https://www.googleapis.com/auth/gmail.modify']
|
||||||
|
|
Loading…
Reference in a new issue