# Token for rest within rule

**URL:** <https://community.auth0.com/t/token-for-rest-within-rule/56865>\
**Category:** JWT.io\
**Tags:** jwt, rules, login\
**Created:** [January 27, 2021, 7:29am UTC](https://community.auth0.com/t/token-for-rest-within-rule/56865 "2021-01-27T07:29:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wahmed](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/wahmed/32/27782_2.png) [@wahmed](https://community.auth0.com/u/wahmed)\
**Post date:** [January 27, 2021, 7:29am UTC](https://community.auth0.com/t/token-for-rest-within-rule/56865/1 "2021-01-27T07:29:28Z")

</div>

I need some information from my resource server or need to hit an endpoint to do some stuff.  
I want to create JWT token within my rule before the callback. So I could have that endpoint working.  
Is there any workaround to successfully achieve this?

---

<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:** [January 27, 2021, 4:44pm UTC](https://community.auth0.com/t/token-for-rest-within-rule/56865/3 "2021-01-27T16:44:05Z")

</div>

You shouldn’t need a workaround. You just treat the rule as a server making an M2M call.

Here is an example:

[https://community.auth0.com/t/how-do-i-call-my-api-from-a-rule/41309](https://community.auth0.com/t/how-do-i-call-my-api-from-a-rule/41309)

---

<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:** [February 11, 2021, 4:44pm UTC](https://community.auth0.com/t/token-for-rest-within-rule/56865/4 "2021-02-11T16:44:06Z")

</div>

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