I am trying to save the profile picture URL inside an SQL database, and having trouble determining, how big should the VARCHAR(X) column should be. For now, I've just picked a random "should be big enough number" for X but I would like my database to be more optimal.
Asked
Active
Viewed 561 times
1
-
https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers#417184 – jarlh Mar 27 '21 at 21:15
-
Part 1: Chrome limits the maximum length to 2 MB. https://chromium.googlesource.com/chromium/src/+/master/docs/security/url_display_guidelines/url_display_guidelines.md#URL-Length – John Hanley Mar 28 '21 at 02:15
-
Part 2: The picture URL is part of an OAuth Identity Token. These tokens are typically used in an HTTP header. Most implementations have a maximum length for all HTTP headers. Apache is 8 KB, IIS is 16 KB. – John Hanley Mar 28 '21 at 02:17
-
Part 3. Google specifies current size limits for OAuth tokens (2048 bytes total). https://developers.google.com/identity/protocols/oauth2#:~:text=to%20service%20accounts.-,Token%20size,Refresh%20tokens%3A%20512%20bytes – John Hanley Mar 28 '21 at 02:20
-
Part 4: IBM specifies the maximum size of an OAuth JWT key or value at 256 bytes. https://www.ibm.com/blogs/security-identity-access/oauth-custom-token-attributes/ – John Hanley Mar 28 '21 at 02:25
-
1Summary: based upon my experience of never seeing an OAuth token value longer than 256 bytes, I recommend using 256 bytes. If you need to handle anything practical today, use 2048 bytes. – John Hanley Mar 28 '21 at 02:28