Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pwa_api.rst with correct command to get the JWT token #232

Open
wants to merge 1 commit into
base: 5.0.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions pwa_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Get Access token

Before you can start using the API, you need to obtain an access token.

Login to your PWA server, and run something like following..
Login to your PWA docker, and run something like following..

.. code-block:: bash

Expand All @@ -18,7 +18,15 @@ Login to your PWA server, and run something like following..
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL3NjYS5pdS5lZHUvYXV0aCIsImlhdCI6MTQ4NzYyNzE2OS45NjMsInNjb3BlcyI6eyJtY2EiOlsidXNlciJdfSwic3ViIjowfQ.hmKr5GAhabMwSltdyq21__-JSGFXFyhxLB7HxhucXLMOslqVo2yOx4qZoLprBDKcCFnKQ7fQNY0fI9coi9ix40clci--p5iSD-w4gzXaxRm2wvldUDQeA...
$ exit

Copy the output from auth.js which is your access token. Store this on your server somewhere and make sure only you can access it (like chmod 600 ``~/.pwa.token.jwt``\ )
In case of PWA running on a server,

.. code-block:: bash

$ sudo pwa_auth issue --scopes '{"sca": ["admin"] }' --sub 'pwa'
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovLzxob3N0bmFtZT4vcHdhL2F1dGgiLCJpYXQiOjE2NjAyODkzMjkuMSwic3ViIjoicHdhIiwic2NvcGVzIjp7InNjYSI6WyJhZG1pbiJdfX0.dE9nrXcI7jPb7-FETjL3dPNk9Iotx8gxdBXhf7RKntVZ_75cj-cib9GAqoCl00vTBla95mR0QcEnKDW8Ic_RV5dp3mW7rRvlisDToR73RoW1j1C46ufMaeeKx8gw_s40NaKoRhSODV0Dk-Zmbz2mEdwpAOmTJ149zjeLmyChUV5ZR-zh7NpiDGu_MAYpwo3rOK88emeLNF6ke355QQk8uJTeAymSzPPQcBXL9imGl6hIXTdfNniklOAlcEdm3XWe5-EBjWK0ezbhNOZCFiprZcd2wMjQidmCgrhLK-X4gO...
$

Copy the output from auth.js or pwa_auth which is your access token. Store this on your server somewhere and make sure only you can access it (like chmod 600 ``~/.pwa.token.jwt``\ )

Query APIs
----------
Expand Down