A Simplified RESTful workflow
Log out
When you want to terminate the client session, log out to delete the current access token.
Prerequisites
Verify that you are logged in and have a valid access token.
Procedure
Make a request to the /api/logout endpoint by specifying your username (resp. access token) with the User (resp. Authorization: Token) header.
Example: logging out
This example deletes the current access token which logs the user out.
Request:
POST https://trackhubregistry.org/api/logout Authorization: Token 52d07632507e6c17f4dca1a2c6b76fb146078c2eResponse:
200 OK ... { "success": "Successfully logged out." }
Example Clients
use strict; use warnings; use JSON; use HTTP::Request::Common; use LWP::UserAgent; # install LWP::Protocol::https as well my $auth_token = 'exampletoken'; my $ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 0 }); my $request = POST('https://trackhubregistry.org/api/logout', 'Content-type' => 'multipart/form-data', 'Authorization' => "Token $auth_token" ); my $response = $ua->request($request); my $response_message; if ($response->is_success) { print "Logged out successfully!\n" if $response; } else { die sprintf "Couldn't logout, reason: %s [%d] ", $response->content, $response->code; }