Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7014789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:34:01+00:00 2026-05-27T22:34:01+00:00

Note: Although I raise this issue in the context of an iOS app, I

  • 0

Note: Although I raise this issue in the context of an iOS app, I don’t think it’s confined to an app running on that specific OS.

I’m developing an iOS application that will back up user data to a server and I’m trying to figure out the best way to verify server-side that the user being updated is actually the real user. Each user will have an id (uid). If that’s all I depended on server-side, then I imagine the process would go like this:

  • User runs app for the first time
  • Creates account in the app, which communicates with the server to both create the account on the server and to get a unique “user id” (uid)
  • App stores this uid so that it can identify the user in subsequent communications with the server

However, if someone were to hack the app on their iphone, they could change the user id value and then that would instantly give them access to/allow them to modify a different user’s data.

The current solution I’m considering is that the user receives 2 unique ids, the uid (just an auto-incremented number) and a longer, more complex key string. All communication with the server will therefore have to send along both the uid and the key. The server will verify that they match in order to make sure that the user truly is who the app says it is.

So, my question is two-fold:

  1. Is this the correct way to achieve this? Or is there some other standard method that I should pursue?
  2. If this is the correct approach, what’s the recommended way to generate the unique key?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T22:34:02+00:00Added an answer on May 27, 2026 at 10:34 pm

    First of all, you can use the more complex value as the user ID to begin with, if you like (e.g. a UUID). Monotonically increasing IDs get hard to manage as your service scales.

    You have the same problem a secure web site does when it leaves secure cookies on the browser to remember a session. Those cookies do include the user ID, but must prevent tampering. This is generally done by signing the cookie on the server before sending it back.

    So what you’d do is:

    1. Generate the user ID on the server, and use it to create some sort of “auth token” for the client to have to sign in.
    2. Sign the auth token on the server with a secret key that only your server knows.
    3. Send the auth token to the client, where it is stored for all subsequent logins. Transfer the auth token over HTTPS to prevent someone else from snooping it on the network.

    When the app goes to login, send up the auth token to the server. If it’s been hacked, the signature validation will fail, and you’ll know to reject the client.

    Consider including a timestamp in the signed token as well, so it expires after some time, forcing the server to regenerate an auth token periodically, which protects you in case your key is compromised. It’s hard to do this all fully unless the user himself has a shared secret/password he can use to authenticate periodically as well. Depends on how far you need to go.

    Other considerations: If all you know about a user is their generated UID, you don’t have any way for that user to come back later from a different iOS device and restore their account there, right? Generally, if the user will be creating anything “valuable” in their account that they’ll want access to later, you’ll probably want to create a more traditional user account backed by an email address and password or the like, so they can access the account again after reinstalling your app. (This may or may not be relevant to your case.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Note that this is for an ApiController in MVC 4 although I think it
Please note that although it sounds similar, this is not the common how to
Note: Although my particular context is Objective-C, my question actually transcends programming language choice.
Note: this is with SQLite, although I expect the problem is on the Qt
Note: although seemingly similar, this is not a duplicate of Overriding fillInStackTrace for a
FINAL NOTE Final solution found in another post Although I appreciated the clarification that
Note: Although I use a zipcode database with Dutch zipcodes, this question is country
Note: This was posted when I was starting out C#. With 2014 knowledge, I
Note: Originally this question was asked for PostgreSQL, however, the answer applies to almost
Note that I am not asking which to choose (MVC or MVP), but rather

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.