OAuth
Request token
Request an OAuth access token with Basic Auth or an assertion. When making a request with an assertion, do not provide the Basic Auth header. See also OAuth 2.0 in the Wallet API Security documentation.
Use oauth2.asnapius.com for Airship’s North American cloud site and oauth2.asnapieu.com for Airship’s European cloud site when requesting an OAuth token.
POST /token
Security:
Request headers:
- Content-Type stringREQUIREDThe request must have a
Content-Typeofapplication/x-www-form-urlencoded.
Request body:
Content-Type:
One ofapplication/x-www-form-urlencoded- Request token with Basic Auth objectOBJECT PROPERTIES
- grant_type stringREQUIRED
Possible values:
client_credentials
- ipaddr string
A list of CIDR representations of valid IP addresses to which the issued token is restricted. IP addresses can be sent as a URL-encoded, space-delimited list (example:
ipaddr=24.20.40.0%2F24%202001%3A4860%3A4860%3A%3A8888%2F32) or as a list as expected in a query parameter form (example:ipaddr=24.20.40.0/24&ipaddr=2001:4860:4860::8888/32). - scope string<OAuth Scope>
A list of scopes to which the issued token will be entitled. Scopes can be sent as URL-encoded, space-delimited list (example:
scope=wpas%20wtmp) or as a list as expected in a query parameter form (example:scope=wpas&scope=wtmp).The value of the scope parameter is a list of space-delimited, case-sensitive strings. If multiple scopes are specified, their order does not matter. Each string adds an additional access range to the requested scope. For more information about scope values, see OAuth token scopes in the Wallet API Authorization Reference documentation.
wadl: Adaptive Linkswevt: Eventswfli: Flightswnot: Notificationswpas: Passeswprj: Projectswsch: Scheduleswseg: Segmentswrpt: Statisticswtmp: Templates
Possible values:
wadlwevtwfliwnotwpaswprjwschwsegwrptwtmp
A space-delimited set of identifiers for which subjects a token is allowed. An
appsubject is required. Example:app:JQIMcndxIHWy2QISpt1SpZ.A space-delimited set of identifiers for which subjects a token is allowed. Example:
app:JQIMcndxIHWy2QISpt1SpZapp: May operate on the given app
- Request token with assertion objectOBJECT PROPERTIES
An encoded JWT that contains the required headers and claims and is signed with the client credentials’ private key.
A JSON Web Token (JWT) used for authorization in OAuth token requests. The JWT must be signed with the private key corresponding to the
client_idin thekidheader using the ES384 algorithm.- grant_type stringREQUIRED
Possible values:
client_credentials
Responses
200
Returned on token request success.
Response headers:
- Cache-Control string
Possible values:
no-store
- Content-Type string
Possible values:
application/json
- Pragma string
Possible values:
no-cache
Response body:
- Content-Type:
application/jsonIssued access token.
OBJECT PROPERTIES- access_token string
The issued token that can be used for all endpoints as allowed by set scopes.
- expires_in integer
The number of seconds from the time the token is generated until it expires.
- scope string<OAuth Scope>
A space-delimited list of scopes of the issued token. There may be undocumented scopes in this list.
The value of the scope parameter is a list of space-delimited, case-sensitive strings. If multiple scopes are specified, their order does not matter. Each string adds an additional access range to the requested scope. For more information about scope values, see OAuth token scopes in the Wallet API Authorization Reference documentation.
wadl: Adaptive Linkswevt: Eventswfli: Flightswnot: Notificationswpas: Passeswprj: Projectswsch: Scheduleswseg: Segmentswrpt: Statisticswtmp: Templates
Possible values:
wadlwevtwfliwnotwpaswprjwschwsegwrptwtmp
- token_type string
The type of issued token.
Possible values:
Bearer
400
Token not generated.
Response body:
- Content-Type:
application/jsonToken request error.
OBJECT PROPERTIES- error stringREQUIRED
Error code.
Possible values:
invalid_scopeinvalid_requestinvalid_grantunauthorized_clientunsupported_grant_typeinvalid_client
- error_description string
A plain-text description of the error.
401
Unauthorized.
Response headers:
- WWW-Authenticate string
The HTTP authentication methods that can be used to request an access token.
Response body:
- Content-Type:
application/jsonAuthentication via the
OBJECT PROPERTIESAuthorizationrequest header failed.Error code.
Possible values:
invalid_client
A plain-text description of the error.
406
Not acceptable.
Response body:
- Content-Type:
application/jsonUnsupported
OBJECT PROPERTIESAcceptheader. The request only supportsapplication/json,application/x-www-form-urlencoded,text/plain.- error stringREQUIRED
Error code.
Possible values:
invalid_request
- error_description string
A plain-text description of the error.
Examples
Example request
POST /token HTTP/1.1
Host: oauth2.asnapius.com
Authorization: Basic <Base64 client_id:client_secret>
Accept: application/json
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials&scope=wtmp%20wprj&sub=app:<project_id>
POST /token HTTP/1.1
Host: oauth2.asnapius.com
Authorization: Basic <Base64 client_id:client_secret>
Accept: application/json
Content-Type: application/x-www-form-urlencoded
grant_type=assertion&assertion=<ES384 encoded JWT>
Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"access_token": "...",
"expires_in": 3600,
"scope": "wtmp wprj",
"token_type": "Bearer"
}
Verify public key
Retrieve the public key of a key ID. Use oauth2.asnapius.com for Airship’s North American cloud site and oauth2.asnapieu.com for Airship’s European cloud site when verifying an OAuth public key.
GET /verify/public_key/{kid}
Path parameters:
- kid stringREQUIREDThe private key ID used to sign the token. Example:
8817e96
Responses
200
Returned on success with the public key for the given
kid.Response headers:
- Cache-Control string
The response contains a
Cache-Controlheader which must be respected.
Response body:
- Content-Type:
application/x-pem-fileType:
stringThe PEM-formatted public key.
404
The requested resource doesn’t exist.
Response body:
- Content-Type:
application/jsonType:
objectThe error includes as much information as possible to help you understand the reason for the failure.