From 0ce825492c0a5a18e4e3b00ef60525916612ab40 Mon Sep 17 00:00:00 2001 From: Akshay Raj Gollahalli Date: Sun, 20 Oct 2019 11:48:36 +1300 Subject: [PATCH] example for token verification added --- README.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.rst b/README.rst index 5df06712b..c903624d2 100644 --- a/README.rst +++ b/README.rst @@ -128,6 +128,21 @@ refresh token to obtain another access token: ... {"access":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX3BrIjoxLCJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiY29sZF9zdHVmZiI6IuKYgyIsImV4cCI6MTIzNTY3LCJqdGkiOiJjNzE4ZTVkNjgzZWQ0NTQyYTU0NWJkM2VmMGI0ZGQ0ZSJ9.ekxRxgb9OKmHkfy-zs1Ro_xs1eMLXiR17dIDBVxeT-w"} +To verify ``access`` and ``refresh`` token, you can use curl by posting ``token`` key followed by ``access`` or ``refresh`` token: + +.. code-block:: bash + + curl \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX3BrIjoxLCJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiY29sZF9zdHVmZiI6IuKYgyIsImV4cCI6MTIzNDU2LCJqdGkiOiJmZDJmOWQ1ZTFhN2M0MmU4OTQ5MzVlMzYyYmNhOGJjYSJ9.NHlztMGER7UADHZJlxNG0WSi22a2KaYSfd1S-AuT7lU"}' \ + http://localhost:8000/api/token/verify/ + + ... + {"detail":"Token is invalid or expired","code":"token_not_valid"} + +If the token is valid, the value returned is ``{}``. + Settings --------