context.accessToken[namespace + 'org'] = context.organization;
Does namespace have a valid value e.g. http://www.myexample.com/org_id? If not it might be getting silently excluded
By default, Auth0 always enforces namespacing; any custom claims with non-namespaced identifiers will be silently excluded from tokens and silently ignored in Actions and Rules.
https://auth0.com/docs/secure/tokens/json-web-tokens/create-namespaced-custom-claims
You can debug these rules quite easily by adding some debug statements to your rule e.g. console.log(namespace + 'org') and installing and running the Real-time Webtask Logs extension
Finally, here's a full Rule example for adding a custom claim to access token:
function addAttributes(user, context, callback) {
const namespace = configuration.Namespace;
context.accessToken[`${namespace}org_id`] = 'test';
callback(null, user, context);
}
note: configuration.Namespace is a rule setting with a value of something like http://www.myexample.com/