# Token expiry

**URL:** <https://community.monzo.com/t/token-expiry/59376>\
**Category:** Developers\
**Created:** [4 February 2019 09:49 UTC](https://community.monzo.com/t/token-expiry/59376 "2019-02-04T09:49:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jan8p](https://avatars.discourse-cdn.com/v4/letter/j/71e660/32.png) [@jan8p](https://community.monzo.com/u/jan8p)\
**Post date:** [4 February 2019 09:49 UTC](https://community.monzo.com/t/token-expiry/59376/1 "2019-02-04T09:49:22Z")

</div>

Hi all,

Potentially stupid question here, but I will ask anyway.

I’ve finally got around to writing my own authentication process. When you exchange the authorization code for the access token, I receive, as expected, the “expires\_in” argument which looks to be set at 107999.

Now assuming this is in seconds, that is just under 30 hours. The API guide states tokens are valid for several hours.

Has the token expire time been increased, or is it set at 30 hours because its a confidential client?

I have no issues either way, just trying to clarify when I should be refreshing my token.

Thanks!

```auto

```

---

<div class="post-metadata">

**Author:** ![Dan\_R](https://dub1.discourse-cdn.com/monzo/user_avatar/community.monzo.com/dan_r/32/13897_2.png) [@Dan\_R](https://community.monzo.com/u/Dan_R)\
**Post date:** [4 February 2019 11:37 UTC](https://community.monzo.com/t/token-expiry/59376/2 "2019-02-04T11:37:00Z")

</div>

The confidential client expires in 107999 seconds…

Non-confidential expires much quicker… I’ve always had 107999 for confidential so refresh just before 30 hours… 🙂

Out of interest, what have you written it in?

---

<div class="post-metadata">

**Author:** ![jan8p](https://avatars.discourse-cdn.com/v4/letter/j/71e660/32.png) [@jan8p](https://community.monzo.com/u/jan8p)\
**Post date:** [4 February 2019 11:44 UTC](https://community.monzo.com/t/token-expiry/59376/3 "2019-02-04T11:44:38Z")

</div>

Thanks, I will schedule in my refresh for 29 hours 🙂

It’s in PHP. I handle the initial authentication via browser which once authenticated stores the credentials in MySQL, and then back end PHP scripts take over and pull all my transactional data into a table on a schedule.

I’m not entirely sure what I’m going to do with the masses of transactional data I have yet, but for now I’ve overlayed the countries I visit on to Google Maps:

[https://hermione.killsta.co.uk/monzo-testing/map](https://hermione.killsta.co.uk/monzo-testing/map)

---

<div class="post-metadata">

**Author:** ![Dan\_R](https://dub1.discourse-cdn.com/monzo/user_avatar/community.monzo.com/dan_r/32/13897_2.png) [@Dan\_R](https://community.monzo.com/u/Dan_R)\
**Post date:** [4 February 2019 12:04 UTC](https://community.monzo.com/t/token-expiry/59376/4 "2019-02-04T12:04:40Z")

</div>

Nice one! Will you open source it onto GitHub?

I have done some work with the new receipts API and can now go to a web link, select my transaction and add a digital receipt 🙂

I just need to make it streamlined and then I was going to open source it 🙂 if you want to collab let me know 🙂

---

<div class="post-metadata">

**Author:** ![jan8p](https://avatars.discourse-cdn.com/v4/letter/j/71e660/32.png) [@jan8p](https://community.monzo.com/u/jan8p)\
**Post date:** [4 February 2019 13:17 UTC](https://community.monzo.com/t/token-expiry/59376/5 "2019-02-04T13:17:35Z")

</div>

I will at some point.

At the minute my code is very much in the “write it and make it work stage” so it’s not very pretty 😃

Receipt page sounds good actually. I travel a lot on business and therefore need my receipts for expenses, uploading them would be handy…
