Sign In Register

How can we help you today?

Start a new topic

REST basic auth example


I am struggling to find the code example for basic auth using only REST API with out any SDK.

I am making a game in Javascript, where I am not allowed to add any external library for now. So the best option I found is call the REST API directly as AJAX.

I am trying with "" and sending "userName" and "password" as a JSON params. But it never works on my side.

While testing on "Test Harness" it works.

Any pointer to the right direction would help.


Hi saumya,

That endpoint is utilized for the retrieval of a JWT Token. This is to auth the GameSparks account for access to the config, as opposed to granting access to a player.

You can use the Requests API to make authentication calls, however, it's important to realise that since we're using the REST API, there won't be any connection after authentication. You'll have to send the auth-token alongside the other parameters in any subsequent request.


Hi Padraig,

How would one use the authentication token in the Requests API? Is it the 'secret' in the request blueprint in the docs?

`POST /rs/{credential}/{secret}/LogEventRequest`

One other use case for this, is when backgrounding the app on iOS it doesn't seem possible to send a request with the Unity SDK since it uses web sockets. Updating the latest info when backgrounding is useful for analytics purposes.

Exactly @Baris Tumerkan I could not make out what to do and how to do. So jumped to another provider just for the sake of docs.

Though the offering here seems a lot, but the problem is documentation.

I am hoping for a clean doc or step by step guide for a noob.


For the answer to my question, adding "authToken" and "playerId" in the request body works (with the credential being set to "player", and the Rest API policy set to "Allowed with authentication token" in the configurator).

Login to post a comment