oauth2server: authorization flow fixes

Fixes issues with the oauth2server authorization flow as well as adds test for restful APIS.

Supersedes PR #2003 
1: D400 First line should end with '.', not 't'
1: D200 One-line docstring should not occupy 3 lines
23: I100 license is missing
58: D400 First line should end with '.', not 'n'
58: D200 One-line docstring should not occupy 3 lines
81: D400 First line should end with '.', not 'n'
81: D200 One-line docstring should not occupy 3 lines
121: D103 Docstring missing
155: D103 Docstring missing
179: D103 Docstring missing
201: D103 Docstring missing
217: D103 Docstring missing
243: D103 Docstring missing
274: D103 Docstring missing