-
Notifications
You must be signed in to change notification settings - Fork 5
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
Parse openvidu's "token" into useful object and json #13
Comments
I just realized after re-consulting the ov docs for POST This line could instead just return the response. Is there a particular reason it currently returns the URI? This would be a potentially breaking change, but it seems like the default should be a dict. |
Well there are a few reasons behind this solution:
If you feel like this does have a valid use-case a proper solution would be creating a "OpenViduToken" object (similar to OpenViduConnection for example) which provides getters for all properties in the dictionary returned. The reason behind using Python data objects instead of raw dicts is that IDEs are able to discover it, and provide useful autocompletion. Along with that it's so much easier to document the library so that developers have to read only one documentation while using this library instead of both the OpenVidu API Docs and the docs of this lib. Another reason is that this library is capable of providing a stable interface whereas OpenVidu sometimes changes their API without properly documenting it. So projects built on this library does not have to change their code every time the API is changed. |
This is a key point, it is not really useful to get much more than a confirmation that what was posted was what was associated with the returned, new token. Pyopenvidu's consistent use of python data objects rather than dicts are fine and make good sense as you've explained it. I was drawing attention to the dictionary more because it offers structured data rather than all of it embedded in the URI. I see that OV has the sample return data as:
So even though OV returns structured data, the token is still embedded inside the websocket URI, strangely called, 'token.' It seems like this should be I have not fully implemented OV yet, but had expected I would need to be handling the token directly. For example, in the I'm not sure how to provide that to the frontend without first parsing the URI into components to get at that string. Perhaps I'm missing something here. But my point was that if someone is trying to build a private API to link a python-based web app auth system up with the perms necessary to generate tokens it will need to get at this token string and make it available to the frontend. Edit: This is really a question for OV, I think I went ahead and posted it in their forum. |
So, I got feedback in that thread that OpenVidu does expect a full websocket URI as the token. I added an issue for this to get a bit better docs here: OpenVidu/openvidu.io-docs#39. I think this invalidates this issue. Thanks for the engagment. |
Description
Currently openvidu's api token response is a websocket URI containing useful information like the actual token string and role.
This would likely be more useful if parsed into a dictionary and/or object.
Suggested solution
Not sure if this is a problem for anyone else, but it seems odd to me that the openvidu api returns a URI as a token response in the first place.
The text was updated successfully, but these errors were encountered: