File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,10 @@ def sanitize_fields(self, item):
67
67
item ['username' ] = item ['username' ].lower ().strip ()
68
68
return item
69
69
70
- @blp .arguments (TokenSchema , location = 'form' )
70
+ # TODO: Because SWAGGER-UI password-flow doesn't follow the oauth2 RFC it needs location='form' for it to work.
71
+ # Rewrite is being discussed in https://github.com/swagger-api/swagger-ui/issues/3227
72
+ # https://www.oauth.com/oauth2-servers/access-tokens/password-grant/
73
+ @blp .arguments (TokenSchema , location = 'json' )
71
74
@response_error (Unauthorized ('Invalid credentials' ))
72
75
@blp .response (UserCredentialsSchema )
73
76
def post (self , login_payload ):
Original file line number Diff line number Diff line change 11
11
from apis .corpora import blp as corpora
12
12
from apis .users import blp as users
13
13
14
-
15
14
app = Flask ('NERd' )
15
+ app .config ['PREFERRED_URL_SCHEME' ] = os .environ .get ('NERD_URL_SCHEME' , 'http' )
16
+ app .config ['SERVER_NAME' ] = os .environ .get ('NERD_SERVER_NAME' , '127.0.0.1:5000' )
16
17
17
18
mongoengine .connect (
18
19
db = os .environ .get ('NERD_MONGO_DB_NAME' , 'nerd' ),
37
38
app .config ['OPENAPI_SWAGGER_UI_VERSION' ] = '3.21.0'
38
39
app .config ['API_VERSION' ] = '1.0.0'
39
40
app .config ['API_SPEC_OPTIONS' ] = {
41
+ 'servers' : [{
42
+ 'url' : '{}://{}' .format (
43
+ app .config ['PREFERRED_URL_SCHEME' ],
44
+ app .config ['SERVER_NAME' ]
45
+ ),
46
+ 'description' : 'Default api endpoint'
47
+ }],
40
48
'components' : {
41
49
'securitySchemes' : {
42
50
'oAuth2Password' : {
You can’t perform that action at this time.
0 commit comments