Netlify Identity IDs

The Netlify Identity IDs (alphanumeric), are they available in a download from Netlify? (I checked documentation and the Netlify Identity UI/settings before posting).

I am using Netlify Identity and Fauna DB. If I wanted to check the User IDs (that very long alphanumeric string) in my Fauna DB against the IDs associated with an email in Identity, is that possible?

I’m just looking for a measure to ensure that if my DB ever encounters a problem, I’d be able to access the Identity IDs associated with my users’ email addresses.

My concern is that users have the ability to change email addresses and I want to be sure that I am able to check an updated email user address against an existing user ID outside of my Fauna DB (which has the potential to be incorrect/fail).

Thank you.

You can’t access the IDs yourself I suppose. But you can access them inside serverless functions.

Any Netlify Function with a valid Authorization header containing a valid JWT token obtained from Netlify Identity will be accessible as a user inside Netlify Functions.

For example, if you’re using Netlify Identity Widget:

fetch('/.netlify/functions/checkToken', {
  headers: {
    authorization: `Bearer ${netlifyIdentity.currentUser().token.access_token}`
  },
}).then(response => {
  // do stuff
})

Inside checkToken function:

exports.handler = async (_, context) {
  const userID = context.clientContext.user.sub
}

I’ve hand-typed the code without checking it, so there might be some rough edges, but that’s the concept.

1 Like

Thank you @hrishikesh
I was hoping that the Identity Level 1 was going to be the answer. But I found a simple but weird solution (for my needs):

If you click on the user name in the Identity UI, the user ID is in the URL. LOL. It’s not ideal. It would be nice to have the user ID as a field in the User information > User metadata section (along with name, email, and role) .

Thank you for the serverless function advice.