开发者

Need help trying to understand the OAuth2 Spec

开发者 https://www.devze.com 2023-03-04 04:55 出处:网络
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 spe

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

cr开发者_运维百科edentials = "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.


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

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消