[PR #644] [MERGED] feature: auto refresh user token when token exp in 7 days #675

Closed
opened 2026-02-26 21:32:22 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/dreamhunter2333/cloudflare_temp_email/pull/644
Author: @dreamhunter2333
Created: 4/26/2025
Status: Merged
Merged: 4/26/2025
Merged by: @dreamhunter2333

Base: mainHead: feature/dev


📝 Commits (1)

  • 3afe955 feature: auto refresh user token when token exp in 7 days

📊 Changes

7 files changed (+32 additions, -4 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 frontend/src/api/index.js (+14 -1)
📝 frontend/src/store/index.js (+2 -0)
📝 worker/src/user_api/oauth2.ts (+1 -1)
📝 worker/src/user_api/passkey.ts (+1 -1)
📝 worker/src/user_api/settings.ts (+11 -0)
📝 worker/src/user_api/user.ts (+1 -1)

📄 Description

PR Type

enhancement, bug fix


Description

  • Reduce JWT expiration from 90 to 30 days

  • Auto-refresh user token if expiring in 7 days

  • Update frontend to handle new user token

  • Add new_user_token to global state


Changes walkthrough 📝

Relevant files
Enhancement
oauth2.ts
Reduce JWT expiration period                                                         

worker/src/user_api/oauth2.ts

  • Change JWT expiration from 90 to 30 days
+1/-1     
passkey.ts
Reduce JWT expiration period                                                         

worker/src/user_api/passkey.ts

  • Change JWT expiration from 90 to 30 days
+1/-1     
settings.ts
Auto-refresh user token logic added                                           

worker/src/user_api/settings.ts

  • Add logic to auto-refresh token if expiring in 7 days
  • Create new JWT with 30 days expiration
  • Include new_user_token in response
  • +11/-0   
    user.ts
    Reduce JWT expiration period                                                         

    worker/src/user_api/user.ts

    • Change JWT expiration from 90 to 30 days
    +1/-1     
    index.js
    Handle new user token in API requests                                       

    frontend/src/api/index.js

  • Modify API fetch to use new user token
  • Implement auto-refresh logic for user JWT
  • +14/-1   
    index.js
    Update global state with new token                                             

    frontend/src/store/index.js

    • Add new_user_token to global state
    +2/-0     

    Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.

  • 🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

    ## 📋 Pull Request Information **Original PR:** https://github.com/dreamhunter2333/cloudflare_temp_email/pull/644 **Author:** [@dreamhunter2333](https://github.com/dreamhunter2333) **Created:** 4/26/2025 **Status:** ✅ Merged **Merged:** 4/26/2025 **Merged by:** [@dreamhunter2333](https://github.com/dreamhunter2333) **Base:** `main` ← **Head:** `feature/dev` --- ### 📝 Commits (1) - [`3afe955`](https://github.com/dreamhunter2333/cloudflare_temp_email/commit/3afe95529d75eaf812a3aac5c52dd5159e814f19) feature: auto refresh user token when token exp in 7 days ### 📊 Changes **7 files changed** (+32 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `frontend/src/api/index.js` (+14 -1) 📝 `frontend/src/store/index.js` (+2 -0) 📝 `worker/src/user_api/oauth2.ts` (+1 -1) 📝 `worker/src/user_api/passkey.ts` (+1 -1) 📝 `worker/src/user_api/settings.ts` (+11 -0) 📝 `worker/src/user_api/user.ts` (+1 -1) </details> ### 📄 Description ### **PR Type** enhancement, bug fix ___ ### **Description** - Reduce JWT expiration from 90 to 30 days - Auto-refresh user token if expiring in 7 days - Update frontend to handle new user token - Add `new_user_token` to global state ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>oauth2.ts</strong><dd><code>Reduce JWT expiration period</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> worker/src/user_api/oauth2.ts - Change JWT expiration from 90 to 30 days </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/644/files#diff-fede9bc68112c797eefa07c6e6cc20a6aa107addb3e5636757131589a435e13b">+1/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>passkey.ts</strong><dd><code>Reduce JWT expiration period</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> worker/src/user_api/passkey.ts - Change JWT expiration from 90 to 30 days </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/644/files#diff-cabc4dc44f7dd8ba02ec517fb6cf097f5f71e2fd01d122d55d306c119600684f">+1/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>settings.ts</strong><dd><code>Auto-refresh user token logic added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> worker/src/user_api/settings.ts <li>Add logic to auto-refresh token if expiring in 7 days<br> <li> Create new JWT with 30 days expiration<br> <li> Include <code>new_user_token</code> in response </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/644/files#diff-0e41b1cd8b40c15de837bee6cf774f29499e490f0b565b0f5556b549f7344dd3">+11/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>user.ts</strong><dd><code>Reduce JWT expiration period</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> worker/src/user_api/user.ts - Change JWT expiration from 90 to 30 days </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/644/files#diff-aafbb1e6861a3f5ecb2bd9d51e2bf9f11f13aa96302eb755f91c233bae2a296e">+1/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.js</strong><dd><code>Handle new user token in API requests</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> frontend/src/api/index.js <li>Modify API fetch to use new user token<br> <li> Implement auto-refresh logic for user JWT </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/644/files#diff-80f7e17c8e1f299b7316ce792286ebcaab67ed3afc050e3c5019ed33ab61b34b">+14/-1</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.js</strong><dd><code>Update global state with new token</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> frontend/src/store/index.js - Add `new_user_token` to global state </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/644/files#diff-0c36ce15651c51795b411359e8caaf5af7960c82674b4f2015b8dd5f480fde2c">+2/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
    kerem 2026-02-26 21:32:22 +03:00
    Sign in to join this conversation.
    No milestone
    No project
    No assignees
    1 participant
    Notifications
    Due date
    The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

    No due date set.

    Dependencies

    No dependencies set.

    Reference
    starred/cloudflare_temp_email#675
    No description provided.