0

This is what I have access to from the user:

email_verified
family_name
given_name
name
nickname
picture
sub
updated_at

The api wants an id /api/v2/users/{id}. I tried using the sub but it did not work. How do I get access to the user id? Or what else do I pass in?

4
  • What if I am using the lock widget to create users? How can I access their id , and if not how can I update their information? Commented Mar 28, 2018 at 17:18
  • So even when you sign up that isn't creating a user ? Commented Mar 28, 2018 at 17:33
  • What do you mean with "signup". The user already signed up on the social platform like facebook. The he uses this facebook account on your application to authenticate that he is he and nobody else. You do not create a user yourself at any point. Where would you want to persist these users? Then you would need a backend to store user information. Commented Mar 28, 2018 at 17:40
  • On the widget their is a sign up tab. As in not using the social stuff. I made an account with an email and password with it. And could sign in using those credentials. Commented Mar 28, 2018 at 17:42

1 Answer 1

1

When creating a user by posting to /api/v2/users the response contains the user_id as a field. The response you get looks e.g. like this:

{
  "email": "[email protected]",
  "email_verified": false,
  "username": "johndoe",
  "phone_number": "+199999999999999",
  "phone_verified": false,
  "user_id": "usr_5457edea1b8f33391a000004", <-- this is the user id
  "created_at": "",
  "updated_at": "",
  "identities": [
    {
      "connection": "Initial-Connection",
      "user_id": "5457edea1b8f22891a000004",
      "provider": "auth0",
      "isSocial": false
    }
  ],
  "app_metadata": {},
  "user_metadata": {},
  "picture": "",
  "name": "",
  "nickname": "",
  "multifactor": [
    ""
  ],
  "last_ip": "",
  "last_login": "",
  "logins_count": 0,
  "blocked": false,
  "given_name": "",
  "family_name": ""
}

You need that id in order to request user data via /api/v2/users/{id}.

If you don't the user_id you can try to get it via the /api/v2/users-by-email endpoint. The information you have according to your question is not enough. What happened to the other information?

EDIT:

What if I am using the lock widget to create users? How can I access their id , and if not how can I update their information?

You can't create users using the lock widget. The user is registered on a social platform like facebook or google. The lock widget does only authenticate them via that platform any gives you some information about them which you of course can't edit because you do not own that data

Sign up to request clarification or add additional context in comments.

4 Comments

I have no clue, I am using this tutorial here: auth0.com/docs/quickstart/spa/react/02-user-profile and that is the data I got back. Is it different when using an SPA?
@TaylorAustin See my updated answer. You can use that data in your app but you can't edit it because you do not own that data. This data comes from the social platform the user has authenticated with.
So I can't like add information to be stored on that account in anyway? Or would I need to attach like a mongodb? And store that user somehow?
Because there is a sign up during the lock widget. I'm guessing it is just making a user for Auth0, but I am not sure how that works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.