Trouble with Configure Identity Provider Connection for User Profile Updates

I am using gmail login as one of the ways to log in. I tried to update the nickname and I got a message to read this link: Configure Identity Provider Connection for User Profile Updates. After reading the link, I was able to get the options object as the page suggested. The issue I’m having is actually sending the update value. Here is my code pasted below.

        access_token = token_data.get("access_token")
        url = f"https://{os.getenv('AUTH0_DOMAIN')}/api/v2/connections/{os.getenv('AUTH0_GOOGLE_CONNECT_ID')}?fields=options"
        headers = { 'Authorization': f"Bearer {access_token}" }
        response = requests.request("GET", url=url, headers=headers, data={})
        options = response.json()
        options["options"]["set_user_root_attributes"] = {}
        options["options"]["set_user_root_attributes"]["nickname"] = "testing123"
        print(options)
        url = f"https://{os.getenv('AUTH0_DOMAIN')}/api/v2/connections/{os.getenv('AUTH0_GOOGLE_CONNECT_ID')}"
        headers = {
            'content-type': "application/json",
            'authorization': f"Bearer {access_token}",
            'cache-control': "no-cache"
        }
        response = requests.request("PATCH", url=url, headers=headers, data = options["options"])

Additionally here is what my options looks like after I modified it to send the update value:

{'id': 'con_0wtNYlyFUgJscY4L', 'options': {'email': True, 'gmail': False, 'orkut': False, 'scope': ['email', 'profile'], 'sites': False, 'tasks': False, 'blogger': False, 'profile': True, 'youtube': False, 'calendar': False, 'contacts': False, 'analytics': False, 'client_id': '', 'moderator': False, 'coordinate': False, 'picasa_web': False, 'google_plus': False, 'google_books': False, 'google_drive': False, 'spreadsheets': False, 'document_list': False, 'latitude_best': False, 'latitude_city': False, 'url_shortener': False, 'webmaster_tools': False, 'chrome_web_store': False, 'allowed_audiences': '', 'adsense_management': False, 'google_drive_files': False, 'coordinate_readonly': False, 'google_cloud_storage': False, 'content_api_for_shopping': False, 'google_affiliate_network': False, 'set_user_root_attributes': {'nickname': 'testing123'}}, 'is_domain_connection': False}

The error I am getting is: “Invalid request payload JSON format”

Thank you in advance. :slight_smile:

Hey @rodyli123 :wave:

The API endpoint you are using is the Update a connection Management API endpoint that can be used to make updates to your tenant’s connections.

In this case, the documentation is showing how you can this Management API endpoint to update the “Sync user profile attributes at each login” setting in the social connections. (Alternatively, you can disable this setting within the Auth0 Dashboard)

Once the setting is disabled, you can then update the nickname of the social user via the Update a user Management API endpoint - the documentation that explains this further is here: Update Root Attributes for Users

If you mean to update the name of the connection, then that field would be display_name as seen the body parameters here (although that may apply for custom connections only)

Hope this helps!