3

I want to write a mysql database schema for storing OAuth access tokens which is sufficiently generic so that it is capable for supporting any provider that complies with the OAuth standard.

What would be a sensible data length to achieve this aim and why? As far as I can see, no maximum length is enforced by the standard and I don't want to have to change my column length whenever I decide to support a new provider that happens to use larger tokens.

If this is not practical/possible, what would be a sensible length for supporting the more popular OAuth providers and why?

CHOSEN SOLUTION

Using a data type with an undefined length seems to be the only sufficiently generic option for my case.

Rupert Madden-Abbott
  • 12,899
  • 14
  • 59
  • 74
  • 3
    Your question is based on the faulty assumption that it is always advantageous to choose a length that is as small as possible. This is not true for every database. For example, in PostGreSQL, the unlimited length `text` type is just as efficient as a fixed size `char`. – mikerobi Feb 15 '11 at 02:00
  • Fair enough. I have changed the question so it is asking specifically about a mysql implementation. – Rupert Madden-Abbott Feb 15 '11 at 02:06

1 Answers1

7

You can use text data type for this if you don't know the exact length.

KillerFish
  • 5,042
  • 16
  • 55
  • 64