# Refresh Token for Hooks?

**URL:** <https://community.auth0.com/t/refresh-token-for-hooks/53450>\
**Category:** Get Help\
**Tags:** api, refresh-tokens\
**Created:** [November 18, 2020, 2:41pm UTC](https://community.auth0.com/t/refresh-token-for-hooks/53450 "2020-11-18T14:41:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![seth2](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/seth2/32/12977_2.png) [@seth2](https://community.auth0.com/u/seth2)\
**Post date:** [November 18, 2020, 2:41pm UTC](https://community.auth0.com/t/refresh-token-for-hooks/53450/1 "2020-11-18T14:41:17Z")

</div>

Hello,

I’m currently utilizing Auth0 formy FE SPA/ BE .NET Core API application.

I have an Auth Pipeline hook that creates a user in my BE database when a new user is created from the Auth0 signup. In order to create that user in my BE, a token is needed to access the create user endpoint. Currently the hook that I’ve got uses a token that expires every few days, and I’ve read the max is 30 days, but what I would like is a token that never expires, re: something like a Refresh Token.

Is it possible to use a Refresh Token from an Auth0 Pipeline hook? Is that best practice and what would that wiring even look like? Or is there another way to get a token with a longer expiration? Even 6mos to a year would be great.

Any feedback would be appreciated.

Thank you!

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [November 18, 2020, 10:32pm UTC](https://community.auth0.com/t/refresh-token-for-hooks/53450/3 "2020-11-18T22:32:27Z")

</div>

Hi @seth2,

Welcome to the Community!

You can use a client credentials grant in your machine to machine application (the hook). This is very similar to a refresh token, as the client credentials do not expire and can be used to request a new token.

> **[Call Your API Using the Client Credentials Flow](https://auth0.com/docs/get-started/authentication-and-authorization-flow/call-your-api-using-the-client-credentials-flow)**
>
> Learn how to call your API from a machine-to-machine (M2M) application using the Client Credentials Flow.

---

<div class="post-metadata">

**Author:** ![seth2](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/seth2/32/12977_2.png) [@seth2](https://community.auth0.com/u/seth2)\
**Post date:** [November 19, 2020, 6:57am UTC](https://community.auth0.com/t/refresh-token-for-hooks/53450/4 "2020-11-19T06:57:34Z")

</div>

Thanks so much for your response, Dan! I will check out this article and see how best to get it working with my API. If I have any more questions I’ll come back and bug you 😄

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [November 19, 2020, 4:23pm UTC](https://community.auth0.com/t/refresh-token-for-hooks/53450/5 "2020-11-19T16:23:25Z")

</div>

Perfect! Let me know if you run into anything. 🕶

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [December 4, 2020, 4:23pm UTC](https://community.auth0.com/t/refresh-token-for-hooks/53450/6 "2020-12-04T16:23:28Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
