Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 43327ca

Browse files
author
Kevin Harper
committed
tokens now expire
1 parent ed2d5c8 commit 43327ca

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

guides/v2.0/get-started/authentication/gs-authentication-token.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ Request|REST|SOAP
2525
Get an admin token | `POST /V1/integration/admin/token` | `integrationAdminTokenServiceV1`
2626
Get a customer token | `POST /V1/integration/customer/token` | `integrationCustomerTokenServiceV1`
2727

28-
For most {% glossarytooltip 377dc0a3-b8a7-4dfa-808e-2de37e4c0029 %}web API{% endglossarytooltip %} calls, you supply this token in the `Authorization` request header with the `Bearer` HTTP {% glossarytooltip 34ecb0ab-b8a3-42d9-a728-0b893e8c0417 %}authorization{% endglossarytooltip %} scheme to prove your identity. The token never expires, but it can be revoked.
28+
For most {% glossarytooltip 377dc0a3-b8a7-4dfa-808e-2de37e4c0029 %}web API{% endglossarytooltip %} calls, you supply this token in the `Authorization` request header with the `Bearer` HTTP {% glossarytooltip 34ecb0ab-b8a3-42d9-a728-0b893e8c0417 %}authorization{% endglossarytooltip %} scheme to prove your identity. By default, an admin token is valid for 4 hours, while a customer token is valid for 1 hour. You can change these values from Admin by selecting **Configuration > Services > OAuth > Access Token Expiration**.
29+
30+
A cron job that runs hourly removes all expired tokens.
2931

3032
## Request a token {#request-token}
3133

@@ -70,9 +72,9 @@ The following image shows a token request for the {% glossarytooltip 29ddb393-ca
7072

7173
The following example uses the `curl` command to request a token for a customer account:
7274

73-
`curl -X POST "https://magento.host/index.php/rest/V1/integration/customer/token" \
75+
<code>curl -X POST "https://magento.host/index.php/rest/V1/integration/customer/token" \
7476
-H "Content-Type:application/json" \
75-
-d '{"username":"[email protected]", "password":"customer1pw"}'`
77+
-d '{"username":"[email protected]", "password":"customer1pw"}'</code>
7678

7779
The following example makes the same request with {% glossarytooltip 8c0645c5-aa6b-4a52-8266-5659a8b9d079 %}XML{% endglossarytooltip %} for a customer account token:
7880

guides/v2.1/get-started/order-tutorial/order-admin-token.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ This section lists the information that Magento sends to the REST client. These
4646

4747
Most REST calls to Magento require an {% glossarytooltip 34ecb0ab-b8a3-42d9-a728-0b893e8c0417 %}authorization{% endglossarytooltip %} token. The token allows Magento to verify that the caller is authorized to access a system resource. To get a token, you must specify the user's username and password in the payload.
4848

49+
By default, an admin token is valid for 4 hours. To change this value, log in to Admin and go to **Configuration > Services > OAuth > Access Token Expiration**.
50+
4951
See [Token-based authentication]({{page.baseurl}}get-started/authentication/gs-authentication-token.md) for more information about authorization tokens.
5052

5153
**Endpoint**

guides/v2.1/get-started/order-tutorial/order-create-customer.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ You can log in to the Luma store using the user name `[email protected]` and pass
119119

120120
### Get the customer's access token {#get-token}
121121

122-
To get a customer's access token, you must specify the customer's username and password in the payload. You do not need to specify an {% glossarytooltip 34ecb0ab-b8a3-42d9-a728-0b893e8c0417 %}authorization{% endglossarytooltip %} token.
122+
To get a customer's access token, you must specify the customer's username and password in the payload. You do not need to specify an admin {% glossarytooltip 34ecb0ab-b8a3-42d9-a728-0b893e8c0417 %}authorization{% endglossarytooltip %} token.
123+
124+
By default, a customer token is valid for 1 hour. To change this value, log in to Admin and go to **Configuration > Services > OAuth > Access Token Expiration**.
125+
123126

124127
**Endpoint**
125128

0 commit comments

Comments
 (0)