Closed mclark-ably closed 7 months ago
➤ Automation for Jira commented:
The link to the corresponding Jira issue is https://ably.atlassian.net/browse/SDK-3965
Link to internal slack discussion -> https://ably-real-time.slack.com/archives/C030C5YLY/p1700826547995949
CreateTokenRequestObjectAsync()
returns timestamp that is not accepted by the Ably requestToken endpoint e.g.
{"keyName":"<redacted>","ttl":"02:00:00","capability":{"Resources":[{"Name":"*","AllowedOperations":["*"],"AllowsAll":true}]},"timestamp":"2024-04-05T10:11:00.317152+00:00","nonce":"<redacted>","mac":"<redacted>"}
which results in an error returned to the client
Invalid token request body; timestamp must be a valid number; statusCode=400; code=40001
whereas using the deprecated method returns the timestamp as an epoch timestamp that is accepted e.g.
{"keyName":"<redacted>","ttl":7200000,"capability":"{\"*\":[\"*\"]}","timestamp":1712312063326,"nonce":"<redacted>","mac":"<redacted>"}
@mclark-ably is this raised by a customer? We have a link to the internal discussion https://ably-real-time.slack.com/archives/C030C5YLY/p1700826547995949
@sacOO7 Yes, please see internal slack thread - https://ably-real-time.slack.com/archives/C8SPU4589/p1712176190722049
When using CreateTokenRequestObjectAsync() in a .net minimal API with ASP.NET core an ably-dotnet client is unable to decode the JSON response and throws an error
when the returned Content-Type is application/json
Status code: 200 OK ---- Response Headers ---- Date: Wed, 29 Nov 2023 12:01:57 GMT Server: Kestrel Transfer-Encoding: chunked Content Type: application/json Encoding: utf-8 Type: Json ---- Response Body ---- {"keyName":"<redacted>","ttl":"01:00:00","capability":{"resources":[{"name":"_","allowedOperations":["_"],"allowsAll":true}]},"clientId":null,"timestamp":"2023-11-29T12:01:57.695532+00:00","nonce":"<redacted>","mac":"<redacted>"}
Workaround is to use the deprecated method CreateTokenRequestAsync and setting the response type to json
┆Issue is synchronized with this Jira Task by Unito