Testing Social Logins "error_description": "Cannot read property 'shinyproxy_roles' of undefined"

Hey Guys,

I am trying to setup Social logins for a Shinyproxy we have running and we get the following error both with google and Microsoft

{
“error”: “access_denied”,
“error_description”: “Cannot read property ‘shinyproxy_roles’ of undefined”
}

This is the rule i have created.

function (user, context, callback) {
context.idToken[‘https://shinyproxy.io/shinyproxy_roles’] = user.app_metadata.shinyproxy_roles;
callback(null, user, context);
}

I also have a hood to add all users with the following which looks like this
response.user.app_metadata = { “shinyproxy_roles”: “public”};

Note that it works with normal problem if i user the username and password database sign up

Any help would be great !