# How to extend the expires\_in time in Admin API?

**URL:** https://forum.shopware.com/t/how-to-extend-the-expires-in-time-in-admin-api/65925
**Category:** Programming (EN)
**Created:** [1. April 2020 um 09:43 UTC](https://forum.shopware.com/t/how-to-extend-the-expires-in-time-in-admin-api/65925 "2020-04-01T09:43:46Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![abinjohnedamana](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/abinjohnedamana/32/17378_2.png) [@abinjohnedamana](https://forum.shopware.com/u/abinjohnedamana)
#### Post date: [1. April 2020 um 09:43 UTC](https://forum.shopware.com/t/how-to-extend-the-expires-in-time-in-admin-api/65925/1 "2020-04-01T09:43:46Z")

</div>

Hi

I am using Client credential authentication for Admin API

> **[API guide](https://docs.shopware.com/en/shopware-platform-dev-en/admin-api-guide?category=shopware-platform-dev-en%2Fapi)**

unfortunately, my access token expiry time is 600 seconds.

How to increase the expiry time?

I am not getting any refresh token for &nbsp;“grant\_type”: “client\_credentials”&nbsp;

is that available ony for “grant\_type”: “password” ?

---

<div class="post-metadata">

### Author: ![canetti2](https://avatars.discourse-cdn.com/v4/letter/c/a8b319/32.png) [@canetti2](https://forum.shopware.com/u/canetti2)
#### Post date: [1. Mai 2020 um 06:18 UTC](https://forum.shopware.com/t/how-to-extend-the-expires-in-time-in-admin-api/65925/2 "2020-05-01T06:18:02Z")

</div>

Hallo,

mich würde auch sehr interessieren ob man die Lebenszeit des Tokens von lediglich 600 Sekunden verlängern kann - wenn ja wie?

[@Moritz Naczenski]([http://forum.shopware.com/profile/14574/Moritz](http://forum.shopware.com/profile/14574/Moritz) Naczenski „Moritz Naczenski“)‍ : Vielleicht kannst Du Dich mal zu dem Thema äußern?

---

<div class="post-metadata">

### Author: ![abdes](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@abdes](https://forum.shopware.com/u/abdes)
#### Post date: [3. Dezember 2020 um 12:17 UTC](https://forum.shopware.com/t/how-to-extend-the-expires-in-time-in-admin-api/65925/3 "2020-12-03T12:17:57Z")

</div>

Kann man die Lebenszeit&nbsp;des Tokens&nbsp; \_ **in&nbsp;vendor/shopware/platform/src/Core/Framework/Api/EventListener/Authentication/ApiAuthenticationListener.php** \_&nbsp;verlängern.

suche nach :&nbsp;

```
 $tenMinuteInterval = new \DateInterval('PT10M');

```

und ändere die&nbsp;PT10M mit gewünschten&nbsp;Lebenszeit&nbsp;

Beispiele:&nbsp;

P1Y&nbsp;&nbsp; &nbsp;1 year  
P1M&nbsp;&nbsp; &nbsp;1 month  
P1D&nbsp;&nbsp; &nbsp;1 day  
P30D&nbsp;&nbsp; &nbsp;30 days  
PT1H&nbsp;&nbsp; &nbsp;1 hour  
PT5M&nbsp;&nbsp; &nbsp;5 minutes  
PT35S&nbsp;&nbsp; &nbsp;35 seconds

---

<div class="post-metadata">

### Author: ![Nico2](https://avatars.discourse-cdn.com/v4/letter/n/838e76/32.png) [@Nico2](https://forum.shopware.com/u/Nico2)
#### Post date: [9. Januar 2022 um 08:14 UTC](https://forum.shopware.com/t/how-to-extend-the-expires-in-time-in-admin-api/65925/4 "2022-01-09T08:14:30Z")

</div>

Kleine Anmerkung. Die Datei findet sich in neueren Versionen hier:  
vendor/shopware/core/Framework/Api/EventListener/Authentication/ ApiAuthenticationListener.php

---

<div class="post-metadata">

### Author: ![eisen-pavillon.de](https://avatars.discourse-cdn.com/v4/letter/e/f6c823/32.png) [@eisen-pavillon.de](https://forum.shopware.com/u/eisen-pavillon.de)
#### Post date: [12. September 2022 um 12:06 UTC](https://forum.shopware.com/t/how-to-extend-the-expires-in-time-in-admin-api/65925/5 "2022-09-12T12:06:56Z")

</div>

Danke für die Info!

Eine vllt wirklich dumme Frage, da ich mich gerade erst mit der API beschäftige… aber was ist der Sinn dahinter die Gültigkeit bei 10Minuten zu belassen? Wenn ich Applikationen, 3rd Party Services anbinde, will ich doch nicht alle 10minuten den Token erneuern?

Postman hat für das automatische Erneuern auch noch keine Funktion, es gibt Workarounds (Pre-Scripts) aber die eigentliche Frage: Ist das Sicherheitsrisiko so enorm die Gültigkeit z.B auf ein Jahr hochzudrehen?

---

<div class="post-metadata">

### Author: ![bettenundwohnen](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@bettenundwohnen](https://forum.shopware.com/u/bettenundwohnen)
#### Post date: [17. September 2022 um 21:57 UTC](https://forum.shopware.com/t/how-to-extend-the-expires-in-time-in-admin-api/65925/6 "2022-09-17T21:57:44Z")

</div>

dieses Forum ist echt ein witz geworden… warum gibt es das eigentlich noch wenn keiner antwortet :-/

---

<div class="post-metadata">

### Author: ![Hashtag\_Assist](https://avatars.discourse-cdn.com/v4/letter/h/e19b73/32.png) [@Hashtag\_Assist](https://forum.shopware.com/u/Hashtag_Assist)
#### Post date: [29. September 2023 um 08:43 UTC](https://forum.shopware.com/t/how-to-extend-the-expires-in-time-in-admin-api/65925/7 "2023-09-29T08:43:40Z")

</div>

@eisen-pavillon.de

Das ist schon richtig so. Eigentlich baut man einen Authentication Service der sich einloggt und einen Refresh Service der die Tokenlifetime nutzt um sich aus dem Refreshtoken einen neuen zu generieren.  
Hier ist der ganze Prozess gut erklärt:

> **[What Are Refresh Tokens and How to Use Them Securely](https://auth0.com/blog/refresh-tokens-what-are-they-and-when-to-use-them/)**
>
> Learn about refresh tokens and how they help developers balance security and usability in their applications.
