I’m looking to set up a rule for Check if user email domain matches configured domain
, the auto-generated script is what’s shown here: rules/check-domains-against-connection-aliases.js at master · auth0/rules · GitHub
As I went ahead and tested my rule, I’m getting an output of ERROR: Cannot read property 'tenant_domain' of undefined
from using the example context & example user. It looks like that the Context object needs to contain both domain_aliases
and tenant_domain
in order for this to work, is that the case? I’m simply putting my domain to check against inside the array for domainAliases
and that is still running into the ERROR
.
Also, how would I verify this with a google-oauth2
connection user? The context for the successful connection looks totally different from what’s shown in the example, I’m seeing something like this:
{
"request": {
"method": "patch",
"path": "/api/v2/rules/<some_rule_id>",
"query": {},
"body": {
"enabled": true,
"name": "Check if user email domain matches configured domain"
},
"channel": "https://manage.auth0.com/",
"ip": "127.0.0.1",
"auth": {
"user": {
"user_id": "google-oauth2|<some_user_id>",
"name": "<some_name>",
"email": "<some_email>"
},
"strategy": "jwt",
"credentials": {
<redacted>
}
}
},
"response": {
"statusCode": 200,
"body": {
"enabled": true,
"name": "Check if user email domain matches configured domain",
"id": "rul_RxEK0M8IS5TeLfBK",
"order": 1,
"stage": "login_success"
}
}
}
Can someone shed some light on this?