|   |   | 
| Line 21: | Line 21: | 
|  | === All requests === |  | === All requests === | 
|  | 
 |  | 
 | 
|  | All authentication requests are carried out as GET requests with a BrowserID assertion in the Authorization header.
 |  | see http://docs.services.mozilla.com/token/apis.html | 
|  |   |  | 
|  |  Example:
 |  | 
|  |  GET https://token.services.mozilla.com/1.0/simple_storage/2.0
 |  | 
|  |  Authorization: Browser-ID <BrowserID assertion>
 |  | 
|  |   |  | 
|  | ==== Response Codes ====
 |  | 
|  |   |  | 
|  | Successful calls will return a JSON object as specified below.
 |  | 
|  | All error responses will contain a numeric code with additional detail about the error.
 |  | 
|  |   |  | 
|  | {|
 |  | 
|  | |- valign="top"
 |  | 
|  | |200 
 |  | 
|  | |Success
 |  | 
|  |   |  | 
|  | On success, the response body will look like this:
 |  | 
|  |   |  | 
|  |  {
 |  | 
|  |   api_endpoint: "https://node123.storage.services.mozilla.com/user/",
 |  | 
|  |   id: <key_id>,
 |  | 
|  |   key: <key>,
 |  | 
|  |   extra_data: <data> (optional)
 |  | 
|  |  }
 |  | 
|  | |- valign="top"
 |  | 
|  | |404
 |  | 
|  | |invalid URL (should not happen with proper use of the Discovery API)
 |  | 
|  | |- valign="top"
 |  | 
|  | |400
 |  | 
|  | |malformed request
 |  | 
|  |   |  | 
|  |  If this code is returned, the response body will contain one of the following numeric codes:
 |  | 
|  |  2 - missing option or bad values 
 |  | 
|  |  3 - malformed json
 |  | 
|  |  4 - unsupported authentication protocol
 |  | 
|  |   |  | 
|  | |-
 |  | 
|  | |401
 |  | 
|  | |Authentication Failed
 |  | 
|  | |-
 |  | 
|  | |405 
 |  | 
|  | |Unsupported Method
 |  | 
|  | |-
 |  | 
|  | |406
 |  | 
|  | |unacceptable - the client asked for an Accept we don't support (will we actually use this?)
 |  | 
|  | |- valign="top"
 |  | 
|  | |503
 |  | 
|  | |Service Unavailable
 |  | 
|  |   |  | 
|  | If the reponse contains a Retry-After header, the client should respect that header.  If not, the client should retry in no less than ten minutes.
 |  | 
|  | |}
 |  | 
|  | 
 |  | 
 | 
|  | = Access = |  | = Access = |