Auth0 Rules: access to access token from inside Rule code

Zaid,

I got it working! An Auth0 rule that acts on first time sign in user. It makes an API call to get a machine to machine token. It uses the token to call my API so it can register the new user in our database.

I found this example that was a big help in getting the Rule to work.

https://github.com/auth0/rules/blob/master/src/rules/parse.js

Ignore the context.access_token. You need to create your own. Make sure you use the client_id, client_secret and audience of your machine to machine definition.

Good luck.

David

2 Likes