Skip to content

Unable to use token auth in Unity app #1292

Description

@hesselmonk

I've implemented a token endpoint which is working as expected from the js sdk, but when I try to use it from the dotnet/unity sdk like this:

_ablyRealtime = new(new ClientOptions
			                {
				                AuthUrl = new Uri("https://{auth url}"),
				                UseTokenAuth = true,
				                AutomaticNetworkStateMonitoring = false,
				                CustomContext = SynchronizationContext.Current,
				                AutoConnect = false,
			                });

I am unable to connect and always get the unhelpful error message:

[ErrorInfo Reason: Error executing request. Invalid token request body; timestamp must be string or number (See https://help.ably.io/error/40001); Code: 40001; StatusCode: 400 (BadRequest); Href: https://help.ably.io/error/40001]

Using the API key directly works, but as you've stated yourself in this article, it is a really bad idea to embed the api key in the app. How can I fix this?

Tested in both Unity 2022.3.42f and Unity 6000.0.23f, Ably sdk 1.2.15

┆Issue is synchronized with this Jira Task by Unito

Metadata

Metadata

Assignees

Labels

bugSomething isn't working. It's clear that this does need to be fixed.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions