Add user_id to access token via Passwordless API


I’m attempting to set up passwordless login for a project, but I’m not able to figure out how I add the user_id to the access token. Am I wrong for assuming that having an access token without any information has no benefit to me, because I can’t pull anything from the database without at least an identifier?

Am I supposed to also send the id_token when sending API requests? I don’t see this done anywhere else.

I tried to create a rule, and the realtime log shows that my console.log works and the fields I try to set are working

function addUserIDToAccessToken(user, context, callback) {

  context.accessToken[``] = user.user_id;
  return callback(null, user, context);

How come I still receive an access token that doesn’t have a payload at all? Am I doing something wrong, or am I supposed to approach this in a different way?