Auth0 Home Blog Docs

How to fetch client_metadata on lock screen?

auth0
auth0-lock
lock-11
#1

I have added few key value pairs in “Application Metadata” (client_metadata) under advance settings of one of my application. Now I tried to fetch those key value pairs on lock screen but I couldn’t find any way. The @@config@@ object on lock screen doesn’t keep that information. I know there is an other option to make web request to auth0 management api and fetch client detail but I don’t want to make an extra call. So is there any way to fetch that info? Also if this is not possible then what is the best way to call auth0 management api before lock screen initialization and fetch the client_metadata?

#3

Hey there @jah, you can use the Management API to work with the user’s metadata as discussed in the below doc. Give it a look and let me know if it helps you out or if you have any questions, thanks!

You can use the Management API in order to retrieve, create, or update both the user_metadata and app_metadata fields at any point.

#4

Thanks for the answer. Now my scenario is i want to call the lock screen based on the value in client_metadata. If the value is true for any application then i want to show lock passwordless screen else i want to show normal lock screen. So i need that info from management client before this step:
var lock = new Authlock(…);
How can i do that? Is there method provided by auth0 which will be called before initialization of lock sceen?

#5

Hey @jah, I followed up with one of our Senior engineers and found out that this would require a custom code solution leveraging Javascript, below we see the client_metadata GET call to /api/v2/client/{id}, we need to modify this to instead of taking the client_id attribute that is located in the query string. This would return an object that would definitely need to be parsed and target out your desired dataset because it’s going to return everything. Sadly, we don’t have a written up example for this but it is possible. I hope this helps you in your quest but please be sure to let us know if you have any questions on topics in the future!

Read client_metadata with the Management API

client_metadata is included amongst in the response to the GET /api/v2/clients and GET /api/v2/client/{id} endpoints

closed #6

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