node-oauth2-server icon indicating copy to clipboard operation
node-oauth2-server copied to clipboard

Why is the regex like that

Open adin234 opened this issue 10 years ago • 1 comments

https://github.com/thomseddon/node-oauth2-server/blob/b36a06b445ad0a676e6175d68a8bd0b2f3353dbf/lib/grant.js#L158

why do we have a colon (:) in the regex for the grant type?

adin234 avatar Dec 08 '15 08:12 adin234

This is part of the OAuth 2 spec for extended grant types. You can the feature generally documented here:

https://docs.pingidentity.com/bundle/pf_sm_oauth20AndPingfederateAs_pf83/page/concept/extensionGrantTypes_grantTypes.html

Reading the grammar for "grant types" in the formal RFC: https://tools.ietf.org/html/rfc6749#appendix-A.10

You can see that a colon is not valid in a grant type unless the grant type in in the "URI" format, which is used for extended grant types.

Thus, checking for a colon in a regex is a spec-compliant way to check to see if the grant_type is an extended grant type or regular grant type.

This issue can be closed.

markstos avatar Jun 19 '18 18:06 markstos