-
Notifications
You must be signed in to change notification settings - Fork 56
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
token option vs tokenId #33
Comments
There is no such thing as a The |
@paddybyers I find this very confusing and inconsistent unfortunately. For example: In Java
In Ably-js
REST API
I realise this is potentially a breaking change, at least from a client library perspective, but I find that this is very inconsistent unfortunately. In an ideal world, if we had a versioned API now, this would be less of an issue as we could easily introduce new fields in the REST API end point describe above without fear of breaking any client libraries. And we could then do releases of the client lib down the line with major version numbers and a CHANGELOG indicating the changes. Unfortunately we're not able to do that now. I would like to discuss this as my implementation is in fact not consistent with the Java & JS libraries because I misunderstood, and the Spec which we have told everyone to work to, is in fact wrong so we now quite likely have client libraries with different implementations. @kouno FYI, see above as it effects Go & PHP. |
Unfortunately this is all the result of us having changed our requirements and terminology since this was originally specified and implemented.
yes, we should do this if we're ok for things to break at this stage. Of course the system can accept both
yes .. this was originally because we were returning:
We removed the idea of a refresh token, but if we promote the token details to be the entire response body it means we would not be able to extend the contents of the response in future (except by adding fields to That said, I agree that it looks redundant as it is.
I agree it should be
as above; it's a breaking change but I'm open to changing it. I think if the other uses of
We have to decide whether or not there is a requirement to be able to do this; the only advantage presently is that the library gets to find out the expiry time for the token. If in future we had other metadata, or a refresh token, then there might be more of an argument for it. |
Ok, so here is my recommendation on what we change based on a quick chat with @kouno. If you have any feedback, I will amend this so that this change can be used as a spec for others too.
|
@paddybyers and @kouno please see comment above. I believe this is what we agreed, please shout if I missed something. |
@paddybyers and @kouno, one question. The property |
I'd prefer that we don't change it, as we keep it opaque as far as the client library is concerned. |
@paddybyers but I am not sure why we see this as opaque when this capability is derived from JSON provided by the client in every case where it matters. For example, if you want to issue a token and limit the user to a channel you'd do something like (pseudo code alert)
In what case would a use be checking the capabilities unless they a) wanted to examine the actual JSON, b) didn't issue the token themselves using a capability Hash that had been converted to a JSON string? |
@paddybyers if I recall correctly, didn't Martin create the .NET library so that capabilities are exposed as a class and I think he had a capability builder as well. Clearly in that case it's far from opaque. I'm not saying that is right btw, just saying I think that is how he did it. |
Actually I think the opposite. What he did was provide a builder API, meaning that the encoded representation (the JSON string) can be completely opaque. I would prefer that we go this way because then we are free to change the encoded representation if we need to. (More specifically, not break the existing encoding, but add support for new representations.) |
Yes, you are right he makes the actual value opaque which incidentally I am entirely happy with, but from what I understand Martin has done, he has made the capabilities field into something that a developer can work with. As it stands now, we require a developer to know how the JSON works and construct it and then stringify it so we have inherently made it NOT opaque, and then when they want to access the object they have to parse it again in JSON to make any sense of it. So if you ask me, but exposing it as a string, we have in fact made this far less opaque and will encourage developers to work directly with this string. At least if it's JSON, we can always convert from one format to another should we wish to change. As it stands now, we could not do that. Given how simple https://github.com/ably/ably-dotnet/blob/master/src/Ably/Capability.cs and https://github.com/ably/ably-dotnet/blob/master/src/Ably/CapabilityResource.cs are, should we not simply expose capabilities as objects? |
When we chatted today you mentioned that all times are represented as longs (with the exception of
@paddybyers should we change these fields as well to ms since epoch? |
One further note that we discussed, for the Realtime endpoint we currently use |
This is deprecated; use |
yes |
These changes are up in |
@paddybyers I assume you've made these changes on the realtime end then and not in any of the client libraries? I'll update the Ruby library to see if it passes against |
ably-js and ably-java updated with tests passing |
Shiiiiit, that was quick. @paddybyers where do you keep the minions? |
@paddybyers when you are back, can we chat about the final capabilities point? |
@paddybyers where do we stand on the |
We have decided to remove a small remaining format inconsistency, and rename This is because we don't use snake case for property names in json/msgpack. |
Closing |
@paddybyers when implementing the Ably Ruby library I opted to use a
token_id
option as opposed totoken
because I understood that by just passing a token ID the library could authenticate with Ably. However, I see in the Ably JS library that it seems to expect an actual token, whereas if you instance the library with a string token, it is actually a tokenId.Should we not be consistent and require either a token or a tokenId, or should we instead perhaps simply add another option which is tokenId that allows the tokenId string to be passed into the constructor?
FYI, I noticed that in the Ably lib I was using the option api_key instead of key, so that is changed now, see ably/ably-ruby@8b6cc9c
The text was updated successfully, but these errors were encountered: