Google OAuth 2.0 User id datatype for MYSQL

2020-08-17 05:47发布

问题:

I'm implementing Google OAuth 2.0 and noticed that the unique user id returned by Google OAuth is 21 digits long. I thought BIGINT(20) would be enough for this need, but I'm confused now on seeing the length of the user id returned by Google OAuth. Any ideas on how I should go about this ?

回答1:

For saving the id, you should use varchar, beacuse as the data you are trying to save is from 3rd party, you can't be certain if the value will be numeric only(though google user id is numeric only but the convention is still not in our control).