How to update "app_metadata" in Android SDK

As we are using OKTA Auth0 Android SDK for authentication , we are getting “user_metadata” and “app_metadata” object in OKTA Auth0 login response. So, as per our need we can update “user_metadata”. But I’m not able to find how to update “app_metadata” in Android.

Hi @anupkumar.bora,

Welcome to the Auth0 Community!

Using the Auth0 Android SDK there is a updateMetdata method that you can use use to update the user_metadata. In the background, it is calling the Management API’s Update a User endpoint.

For example:

client.updateMetadata("{user id}", "{user metadata}")
    .start(object: Callback<UserProfile, ManagementException> {
        override fun onSuccess(result: UserProfile) { }
        override fun onFailure(error: ManagementException) { }
})

Please see the UsersAPIClient - auth0 2.9.3 javadoc documentation for your reference.

Thanks,
Rueben

Hi @rueben.tiow , as per our need we can update “user_metadata” using `updateMetadata’ method. But I’m not able to update data elements inside “app_metadata”. Can you please provide guidelines/examples on how to do it?

Hi @anupkumar.bora,

Thank you for your reply.

Would you be able to provide me an example of what you have tried so far?

Thanks,
Rueben

Hi @rueben.tiow ,
When I try to pass “https://DineIPAASAPI.com/” (custom API) audience with “WebAuthProvider” class with login method, that time I get “Oops!,something went wrong” error message. Here is the screenshot attached. Can you please provide guidelines on how to get customer access token in Android ?

Hi @anupkumar.bora,

Thanks for following up.

Just to circle back, I have searched through our Auth0 Android SDK and can confirm that there isn’t an equivalent way to update the user’s app_metadata.

To the best of my knowledge, this is by design and will require you to call the Management API to update the user’s app_metadata if this is needed.

I hope I have answered your question!

Please let me know if there’s anything else I can do to help.

Thanks,
Rueben

Hi @rueben.tiow, Can you please provide examples of how to update user’s app_metadata?

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