2

The bearer token spec is the one I have a question about. I'm trying to figure out what characters are allowed in the token when placed in the Authorization: OAuth ...... header. Here's what the spec says

credentials = "OAuth2" RWS access-token [ RWS 1#auth-param ]
access-token = 1*( quoted-char / <"> )

quoted-char = "!" / "#" / "$" / "%" / "&" / "'" / "(" / ")" / "*" / "+" / "-" / "." / "/" / DIGIT / ":" / "<" / "=" / ">" / "?" / "@" / ALPHA / "[" / "]" / "^" / "_" / "`" / "{" / "|" / "}" / "~" / "" / "," / ";"

I'm not sure how to read this. I'm new at reading RFC's so if someone could explain it I would appreciate it.

Community
  • 1
  • 1
Micah
  • 111,873
  • 86
  • 233
  • 325
  • I'm looking at the same spec and am similarly baffled. Perhaps this notation form is explained in one of the documents linked at the top of the spec ("this draft is submitted in conformance with..."). I'll post back here if I figure it out. My tokens have - and _ in them, don't know if I need to escape them! – heavi5ide May 11 '11 at 20:36

2 Answers2

1

It looks like it's augmented BNF from the HTTP/1.1 spec (RFC2616):

http://www.rfc2616.com/#2.1

heavi5ide
  • 1,599
  • 10
  • 11
0

You can simply use Base64 encode.

It doesn't use some of characters (ex. "!", "#"..) in the BNF though.

If you want to know all allowed characters,

"!" / "#" / "$" / "%" means all these characters ("!", "#", "$", "%") are allowed.

nov matake
  • 938
  • 5
  • 6