I just got this working without any significant changes on a Vue SPA (@auth0/auth0-spa-js
). Just have to create a rule that copies the metadata to the idToken. This was helpful: Sample Use Cases: Scopes and Claims
function (user, context, callback) {
const namespace = "https://example.com/";
context.idToken[namespace + 'couch_user_id'] = user.user_metadata.couch_user_id;
return callback(null, user, context);
}
After a fresh login, I could retrieve the couch_user_id property (actual property name: https://example.com/couch_user_id
) on the user
object.