Getting the user_id in our backend API using an access token given from the frontend

I’m trying to call my python backend endpoint whenever I create/login for the first time in my react frontend app. For this, I’ve created a rule that calls my backend endpoint (I’ve already created an API in auth0 that is already linked/authorized to an M2M application) and can see that it successfully pings and receive an access token I’ve created inside the rule (following this guide).

Following the auth0 python guide I successfully decoded the access token and can obtain its value. However, this decoded value does not contain a user_id for me to work upon…
Based on what I’ve searched, I might be able to call /userinfo to obtain the user_id. However, I’ve tried many stuffs and still can’t make it work on my backend with the access token I’ve created in the rule. I’m sure I’m doing something wrong, can someone please guide me towards a better/standard solution to this issue?

Welcome to the Community!

@developers_auth0,

The access token you requested in your rule is a M2M Access Token, and it won’t directly contain data about your user.

You can grab the user’s ID (and any other relevant data) from the user object in rules and send it with your request.