-
Notifications
You must be signed in to change notification settings - Fork 508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OAuth2 password credential doesn't work in SwaggerUI #138
Comments
It is just a lack of implementation in Swagger UI, and here is an open PR swagger-api/swagger-ui#1853. BTW, you may also be interested in an extensive example RESTful API server based on Flask-RESTplus with some patches: https://github.com/frol/flask-restplus-server-example |
But it worked with swagger.json that generated by flask-restplus on this template: https://github.com/swagger-api/swagger-ui/blob/master/dist/index.html |
Password Flow can be displayed in Swagger-UI, but it won't work unless the related support is merged. By the way, once I re-read your initial issue description it occurred to me that you may have missed |
My code looks like this: @ns.route('/me')
class CurrentMemberAPI(Resource):
@api.doc(security=[{'oauth2_password': ['member:read']}])
@api.marshal_with(member_fields)
@oauth.require_oauth('member:read')
def get(self):
"""
Get my member information
"""
return request.oauth.user.dict(include_company=True)
@api.doc(parser=member_parser, security=[{'oauth2_password': ['member:write']}])
@api.marshal_with(member_fields)
@api.response(400, 'Invalid profile file type or Invalid fields set')
@oauth.require_oauth('member:write')
def put(self):
"""
Modify my member information
If you want to upload profile image, fill profile_file field.
Also, you can fill profile[uid] field after upload something
email[] field will not work. If you want to modify member's email, use /member/me/email.
"""
args = Process.parse_args(member_parser.parse_args())
member = request.auth.user
... My swagger.son is perfectly fine as I checked and it worked on other swagger template. |
Everything looks fine to me. Is there any error in Dev tools console? I'm actually using a custom SwaggerUI (the one which includes my PR with Password Flow OAuth2 support) and it works just fine for me, but I know that neither the SwaggerUI master branch nor prepackaged version in Flask-RESTplus will work, so I haven't even try. |
I see, maybe I used dev branch of SwaggerUI for password credential. |
Oh yeah, I remember it now! I have a custom template with uncommented |
In SwaggerUI which created by flask-restplus, just simple request is working well.
But, if I trying to use oauth2 with password credential then the credential popup doesn't show up.
To make sure this problem, I tried to use SwaggerUI from SwaggerUI project page with Swagger json; /swagger.json.
And it worked. But the other SwaggerUI that created by flask-restplus still doesn't work.
I think, something wrong in swagger template at flask-restplus on pip-py3.
Please check it.
The text was updated successfully, but these errors were encountered: