Audience in rules

I’m using rules to return user metadata in GET /userinfo endpoint. To do this i must use

context.idToken[namespace]= user.user_metadata;

However the ‘namespace’ variable must contain URL, otherwise metadata will not be shown. It sets URL as json object’s key in response:

"https://custom-rule.custom-field/": {

        "pc_number": "3",

        "instances_number": "3",

        "expiration_date": "2022-01-30",

        "creation_date": "2021-12-30",


    }

Is there a way to use word instead of URL as json object’s key?
What i’m trying to achieve is

"user_metadata": {

        "pc_number": "3",

        "instances_number": "3",

        "expiration_date": "2022-01-30",

        "creation_date": "2021-12-30",


    }

Hi @bogdanmihalskiy002

The namespace (JSON object’s key in this case) must follow the rules outlined here.

To answer your question; No, you must use a collision resistant namespace that follows a URL schema.

1 Like

Thanks for your help

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.