Get Access TokenAccess tokens are similar to session tokens and allow entering of credentials once per session. Once authenticated, a user is provided with an access token that is submitted with every secure request (those containing '/secure/' in the URL path, e.g. submitting a donation) instead of always submitting a username and password. Access tokens are short-lived and can expire so users need to re-GET a token at the start of each session or if their current access token expires. Note that access token timeouts are individually set for each API user as a database configuration and by default are set to 10 hours. NOTE: Credentials used to receive an access token are the same credentials used when signing up for an API Key. That is, the email and password associated with the new or existing GlobalGiving account used to request an API Key. HTTP Method:GET Content Type:xml, json Accept Type:xml, json Path:https://api.globalgiving.org/api/userservice/tokens Data Parameters:email - user's email used to sign up for the GlobalGiving account and API key, required password - user's password used to sign up for the GlobalGiving account and API key, required api_key - api_key for the api user which is provided by GlobalGiving, required HTTP GET XML Request using cURL:
curl -H "Accept: application/xml" -H "Content-Type: application/xml" -d "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<auth_request>
<user>
<email>John_Doe@hotmail.com</email>
<password>somepassword</password>
</user>
<api_key>YOUR_API_KEY</api_key>
</auth_request>" -X POST https://api.globalgiving.org/api/userservice/tokens
HTTP GET JSON Request using cURL:
curl -H "Accept: application/xml" -H "Content-Type: application/json" -d "{'auth_request':{'user':{'email':'John_Doe@hotmail.com','password':'somepassword'}, 'api_key':'YOUR_API_KEY'}}" -X POST https://api.globalgiving.org/api/userservice/tokens
XML Response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<auth_response>
<access_token>sqbkktg3s00vzz7gg3s198rzb9g3s2me2u2ng3s3</access_token>
</auth_response>
JSON Response:
{"auth_response":{"access_token":"njd9wng4d0ycwnn3g4d1jm30yig4d27iom5lg4d3"}}
Get Access Token Request Structure
Element Definitions for Get Access Token Request
Get Access Token Response Structure
Element Definitions for Get Access Token Response
|

