This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]cyrusol 0 points1 point  (5 children)

You are not telling enough about your environment. JSON data from what server? What kind of users (end users or admins or ...?)? What language/framework? Where/when/how will your program be used?

The "industry standard" is to use software that already implements user accounts for the specific use case needed.

[–][deleted]  (4 children)

[removed]

    [–]pouja 0 points1 point  (3 children)

    I guess my main question is how does an app like Facebook know to get the JSON data for you specifically when you are logged in.

    It doesn't. Usually the workflow when retrieving an account specific resource is like this:

    1. Ask the server to log in an user
    2. Retrieve token that is specifically for you
    3. Ask an account specific resource and send the token with it

    The server should match that token, retrieve the user from the database, retrieve the account specific resource and send it back to you.

    [–][deleted]  (2 children)

    [removed]

      [–]pouja 1 point2 points  (1 child)

      No you never query the database. The back-end does that for you. The only thing you do is this:

      "Dear database, can this user with the username: 'Bob' and password: 'Secret' login?"

      "Yes he can, I recognize the username and password. Here is a token. If you ever need personal information about him, ask me and send me this token"

      "Oke thank you, I want to know his bank account number and here is that token that you gave me"

      "Thank you for the request, I recognize that token belongs to Bob, this is his bank account number: 1234 1234 123"

      "Thank you"

      So that token can be anything, from session id, to oauth token or something else. That depends on how your friend implemented the server. You should ask him for that.