|
1 | 1 | Get a temporary unauthorized token for an API account, this applies to non-web application authorization only. |
2 | 2 |
|
3 | | -## Paramaters |
| 3 | +## Parameters |
4 | 4 | | Method | Type | Default | Required | Description |
5 | 5 | | ------ | ---- | ------- | -------- | ----------- |
6 | 6 | | `api_key` | [string][string] | `none` | :white_check_mark: | A Last.fm API key. |
7 | | -| `api_sig` | [string][string] `none` | :white_check_mark: | A Last.fm method signature, see [signature](signature.md) |
| 7 | +| `api_sig` | [string][string] | `none` | :white_check_mark: | A Last.fm method signature, see [signature](signature.md) |
8 | 8 |
|
9 | 9 | ## Respones |
10 | | -Errors: |
11 | | -- 8 : There was an error granting the request token. Please try again later |
12 | | -- 2 : Invalid service - This service does not exist |
13 | | -- 3 : Invalid Method - No method with that name in this package |
14 | | -- 4 : Authentication Failed - You do not have permissions to access the service |
15 | | -- 5 : Invalid format - This service doesn't exist in that format |
16 | | -- 6 : Invalid parameters - Your request is missing a required parameter |
17 | | -- 7 : Invalid resource specified |
18 | | -- 8 : Operation failed - Something else went wrong |
19 | | -- 9 : Invalid session key - Please re-authenticate |
20 | | -- 10 : Invalid API key - You must be granted a valid key by last.fm |
21 | | -- 11 : Service Offline - This service is temporarily offline. Try again later. |
22 | | -- 13 : Invalid method signature supplied |
23 | | -- 16 : There was a temporary error processing your request. Please try again |
24 | | -- 26 : Suspended API key - Access for your account has been suspended, please contact Last.fm |
25 | | -- 29 : Rate limit exceeded - Your IP has made too many requests in a short period |
| 10 | +Errors: |
| 11 | + |
| 12 | +- 8 : There was an error granting the request token. Please try again later |
| 13 | +- 2 : Invalid service - This service does not exist |
| 14 | +- 3 : Invalid Method - No method with that name in this package |
| 15 | +- 4 : Authentication Failed - You do not have permissions to access the service |
| 16 | +- 5 : Invalid format - This service doesn't exist in that format |
| 17 | +- 6 : Invalid parameters - Your request is missing a required parameter |
| 18 | +- 7 : Invalid resource specified |
| 19 | +- 8 : Operation failed - Something else went wrong |
| 20 | +- 9 : Invalid session key - Please re-authenticate |
| 21 | +- 10 : Invalid API key - You must be granted a valid key by last.fm |
| 22 | +- 11 : Service Offline - This service is temporarily offline. Try again later. |
| 23 | +- 13 : Invalid method signature supplied |
| 24 | +- 16 : There was a temporary error processing your request. Please try again |
| 25 | +- 26 : Suspended API key - Access for your account has been suspended, please contact Last.fm |
| 26 | +- 29 : Rate limit exceeded - Your IP has made too many requests in a short period |
26 | 27 |
|
27 | 28 | ## Examples |
28 | | -url: `http://ws.audioscrobbler.com/2.0/?method=auth.gettoken&api_key=YOUR_API_KEY&format=json` for json or `http://ws.audioscrobbler.com/2.0/?method=auth.gettoken&api_key=YOUR_API_KEY` for xml |
29 | | - |
30 | | -Sample XML Response: |
31 | | -```xml |
32 | | -<lfm status="ok"> |
33 | | - <token>cf45fe5a3e3cebe168480a086d7fe481</token> |
34 | | -</lfm> |
35 | | -``` |
36 | | -Sample JSON Response: |
37 | | -```json |
38 | | -{ |
39 | | - "token":"cf45fe5a3e3cebe168480a086d7fe481" |
40 | | -} |
41 | | -``` |
42 | | - |
43 | | -This token can then be used to authenticate a user by requesting the user to authorize via the auth link, with this token and your api key as parameter. |
44 | | - |
45 | | -Example: http://www.last.fm/api/auth/?api_key=YOUR_API_KEY&token=cf45fe5a3e3cebe168480a086d7fe481 |
46 | | - |
47 | | -After the user has authorized via this url you can use [getSession](getSession.md) |
| 29 | + |
| 30 | +??? note "Example XML response" |
| 31 | + | Parameter | Value | |
| 32 | + | --------- | ------------- | |
| 33 | + | api_key | YOUR_API_KEY | |
| 34 | + |
| 35 | + HTTP status: `200 OK` |
| 36 | + ``` |
| 37 | + http://ws.audioscrobbler.com/2.0/?method=auth.gettoken&api_key=YOUR_API_KEY |
| 38 | + ``` |
| 39 | + ```xml |
| 40 | + <lfm status="ok"> |
| 41 | + <token>cf45fe5a3e3cebe168480a086d7fe481</token> |
| 42 | + </lfm> |
| 43 | + ``` |
| 44 | + |
| 45 | +??? note "Example JSON response" |
| 46 | + | Parameter | Value | |
| 47 | + | --------- | ------------- | |
| 48 | + | api_key | YOUR_API_KEY | |
| 49 | + | format | json | |
| 50 | + |
| 51 | + HTTP status: `200 OK` |
| 52 | + ``` |
| 53 | + http://ws.audioscrobbler.com/2.0/?method=auth.gettoken&api_key=YOUR_API_KEY&format=json |
| 54 | + ``` |
| 55 | + ```json |
| 56 | + { |
| 57 | + "token":"cf45fe5a3e3cebe168480a086d7fe481" |
| 58 | + } |
| 59 | + ``` |
| 60 | + |
| 61 | +??? note "What to do with the token?" |
| 62 | + This token can then be used to authenticate a user by requesting the user to authorize via the auth link, with this token and your api key as parameter. |
| 63 | + |
| 64 | + | Parameter | Value | |
| 65 | + | --------- | --------------- | |
| 66 | + | api_key | YOUR_API_KEY | |
| 67 | + | token | REQUESTED_TOKEN | |
| 68 | + |
| 69 | + ``` |
| 70 | + http://www.last.fm/api/auth/?api_key=YOUR_API_KEY&token=REQUESTED_TOKEN |
| 71 | + ``` |
| 72 | + |
| 73 | + After the user has authorized via this url you can use [getSession](getSession.md) |
| 74 | + |
| 75 | + |
| 76 | +[string]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String |
0 commit comments