Generating an auth token from credentials

Here we will explain how to use your username and password, along with your account id, to generate an authentication token to be used on subsequent requests requiring authentication.

The Authentication Process

Easy as 1, 2, 3:

  1. First, select the hashing method and create your credentials hash:
    • MD5: echo -n “{USERNAME}:{PASSWORD}” | md5sum
    • SHA: echo -n “{USERNAME}:{PASSWORD}” | shasum
  2. Select an account identifier (any one of the three will suffice):
    • Account Name (“account_name”)
    • SIP Realm (“realm”)
    • A Phone Number assigned to the account (“phone_number”)
    • transfer all parameter as data object
  3. Send an HTTP PUT:
 curl -v -X PUT -H "content-type:application/json" https://www.wirecloud.de/api/v2/user_auth -d '{"data":{"credentials":"{CREDENTIALS_HASH}", "account_name":"{ACCOUNT_NAME"}, "method":"[md5|sha]"}}'
    {"auth_token": "{AUTH_TOKEN}"
     ,"data": {
       "account_id": "{ACCOUNT_ID}"
       ,"apps": []
       ,"is_reseller": true
       ,"language": "en-US"
       ,"owner_id": "{OWNER_ID}"
       ,"reseller_id": "{RESELLER_ID}"
     }
     ,"request_id": "{REQUEST_ID}
     ,"revision": "automatic"
     ,"status": "success"
    }
 curl -v -X PUT -H "content-type:application/json" https://www.wirecloud.de/api/v2/user_auth -d '{"data":{"credentials":"{CREDENTIALS_HASH}", "account_name":"{ACCOUNT_NAME"}, "method":"[md5|sha]"}}'
    {"auth_token": "{AUTH_TOKEN}"
     ,"data": {
       "account_id": "{ACCOUNT_ID}"
       ,"apps": []
       ,"is_reseller": true
       ,"language": "en-US"
       ,"owner_id": "{OWNER_ID}"
       ,"reseller_id": "{RESELLER_ID}"
     }
     ,"request_id": "{REQUEST_ID}
     ,"revision": "automatic"
     ,"status": "success"
    }
 

The Response