Potential Bug w. Admin Level API for Higher Level Access -- AttributeError: 'str' object has no attribute 'apikey'
Hello Wonderful OSP Community --
I'm working with the OSP API and I'm encountering an issues which I think might be a bug with the API. Hoepfully not, but I thought I would report it anyway. I've debugged this the best I can. I'm trying to do a basic API operation. As an example, I'm just trying to get information about a user using /user/ API. However, I'm getting an error message about in invalid admin key for every API operation which requires higher level privledge. An example of the call, response and console error message are below.
To confirm, the user has the admin role, the key is an admin key and the key itself was generated by the application. I've confirmed this error using curl, Swagger (built in) and Postman.
I don't belive I'm using this service incorrectly, but any insight on this issue would be appreciated. At the moment, I think it might be an error in the actual application itself.
Thank you. Cheers.
As an example:
/*** EXAMPLE CALL ***/
Curl -- curl -X GET "https://[[URL]]/apiv1/user/" -H "accept: application/json" -H "X-API-KEY: [[GENERATED KEY]]" URL -- https://[[URL]]/apiv1/user/ Response Headers -- access-control-allow-origin: * content-length: 37 content-security-policy: default-src 'self' http: https: data: blob: 'unsafe-inline' 'unsafe-eval' content-type: application/json date: Tue, 27 Apr 2021 21:04:05 GMT referrer-policy: no-referrer-when-downgrade server: nginx/1.17.3 strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff x-frame-options: SAMEORIGIN x-xss-protection: 1; mode=block
/*** ERROR MESSAGE IN THE CONSOLE ***/
If I tail "/opt/osp/logs/osp-error.log.1" I'm getting the following error message:
[2021-04-27 14:21:04,509] ERROR in app: Exception on /apiv1/user/ [GET] Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1950, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1936, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/usr/local/lib/python3.8/dist-packages/flask_restplus/api.py", line 325, in wrapper resp = resource(*args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/flask/views.py", line 89, in view return self.dispatch_request(*args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/flask_restplus/resource.py", line 44, in dispatch_request resp = meth(*args, **kwargs) File "/opt/osp/blueprints/apis/user_ns.py", line 44, in get adminKeyCheck = apiFunc.isValidAdminKey(apiKey) File "/opt/osp/functions/apiFunc.py", line 6, in isValidAdminKey apiKeyQuery = apikey.apikey.query.filter_by(type=2, key=apikey).first() AttributeError: 'str' object has no attribute 'apikey'
/*** TESTING ENVIORMENT ***/
Server Version: 0.8.8 Git Branch: master Git Commit Hash: dada2895 No Update Available Database Version: 0.75
NGINX Version: 1.17.3 NGINX-RTMP Version 1.1.4 EJabberD Status: Online Uptime: 01:35:19 Ubuntu 20.04