Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the data type of a Google Account's unique user identifier?

The unique identifier is documented here as being the "sub" field on ID tokens. The "sub" field value is too large to be 64-bit number. Should it just be considered a string then (for the purposes of storing in a database for example)?

In case the linked content ever changes, below are the relevant details.

ID Token Example

{
  "iss":"accounts.google.com",
  "at_hash":"HK6E_P6Dh8Y93mRNtsDB1Q",
  "email_verified":"true",
  "sub":"10769150350006150715113082367",
  "azp":"1234987819200.apps.googleusercontent.com",
  "email":"[email protected]",
  "aud":"1234987819200.apps.googleusercontent.com",
  "iat":1353601026,
  "exp":1353604926
}

sub Description

"An identifier for the user, unique among all Google accounts and never reused. A Google account can have multiple emails at different points in time, but the sub value is never changed. Use sub within your application as the unique-identifier key for the user."

Thanks!

like image 851
Scott Lin Avatar asked Oct 15 '25 03:10

Scott Lin


2 Answers

From the docs:

An identifier for the user, unique among all Google accounts and never reused. A Google account can have multiple email addresses at different points in time, but the sub value is never changed. Use sub within your application as the unique-identifier key for the user. Maximum length of 255 case-sensitive ASCII characters.

like image 127
Heikki Avatar answered Oct 17 '25 16:10

Heikki


It is a string you can see that because its in quotes. The numbers as "iat":1353601026 are not in quotes hence being numbers.

like image 25
TResponse Avatar answered Oct 17 '25 15:10

TResponse



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!