Authorization

Authorization

To recieve authorization tokens, use the following API:

https://api.digital2go.com/apps/login.json

The API requires you to pass in a login request object as a parameter in the following format:

{
    "username" : “TESTAPIUSER”,
    "password" : “TESTPASSWORD”,
    "device_id" : “1AB422B56B3B49AF8389268A9ACD7246” 
}

You acquire the required usernamepassword, and device_id parameters from the D2GO platform. Now, your response should be a JSON Object in the following format:

{
    "success" : true,
    "data" : {
        "sub" : 1,
        "app_guid" : "c625d076-32d3-11e6-818b-848f69aa5c09",
        "client" : 131,
        "expiry" : 604800,
        "reuse" : {
            "isReused?" : "false",
            "number" : 0,
            "max" : 3
        },
        "development" : true,
        "sns" : "arn:aws:sns:us-west-2:388507267354:0768671a-d722-4955-9356-885cf973f19b",
        "android_arn" : "arn:aws:sns:us-west-2:388507267354:app/GCM/c625d076-32d3-11e6-818b-848f69aa5c09",
        "ios_arn" : "arn:aws:sns:us-west-2:388507267354:app/APNS_SANDBOX/c625d076-32d3-11e6-818b-848f69aa5c09",
        "refresh" : "RDY4ZGVhYjQyNmM2MDc3MDgxMjc4ZGJjMDhmYjRiUmM3ZGQ3OTkyOTRlZmRjNWZjODI4Mjg1YWQzN2UzMzgwN/IpZTAPMM9ks1L+q7fHQuLom+TNx3uV4iOdV751hcFVfV2ZGcf9sMc7/NWGIAqeqPtj3unIItYbFvUJ9kPOP+LjU2lqjCWRyWjnciiHNt+I5CbBCoNBHEJHFo+LgFZQybIKYIEeOI/KRIvXVGryxqc=",
        "token" : "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEsImV4cCI6MTUxNDMzNTkyOSwiZG8tYWluIjoiYXBpLmRpZ2l0YWwyZ28uZGV2In0.KYzAz69Fm-R8TmgpyP1UL1YpYfbObHkAAWpcyRxi_vE"
    }
}

The value of the token property will be required for future API requests.

The ios_arn and sns properties are required to subscribe for push notifications in iOS.

The value of the refresh property is a token that should be stored securely on the application. It should overwrite any previous refresh token; it’s used to re-request a JWT token when it expires.

Other possible responses include:

  • 401 Incorrect Login
  • 422 Incorrect Login
  • 500 Some Other Error Occurred