question

viti-27 avatar image
viti-27 asked

This API method does not allow anonymous callers, when using GetEntityToken

I have that error when I call GetEntityToken, How can I do?

local IPlayFabHttps = require("PlayFab.IPlayFabHttps")
local playfav=require("PlayFab.PlayFabAuthenticationApi")
local PlayFabHttps_Defold = require("PlayFab.PlayFabHttps_Defold")
IPlayFabHttps.SetHttp(PlayFabHttps_Defold)


function init(self)
	playfav.GetEntityToken(nil, onSuccess, onError)
end
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Andy avatar image
Andy answered

How are you authenticating the call? GetEntityToken requires a client session Ticket, a server secret key, or a valid entity token to authenticate.

So, from a client, you'd want to call one of the login APIs first. From a server, you'd want to set PlayFabSettings.settings.devSecretKey first.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

viti-27 avatar image viti-27 commented ·

Then, how can I loging using entity api?

0 Likes 0 ·
viti-27 avatar image
viti-27 answered
local PlayFabClientApi = require("PlayFab.PlayFabClientApi")
local IPlayFabHttps = require("PlayFab.IPlayFabHttps")
local PlayFabHttps_Defold = require("PlayFab.PlayFabHttps_Defold")
IPlayFabHttps.SetHttp(PlayFabHttps_Defold) -- Assign the Defold-specific IHttps wrapper


PlayFabClientApi.settings.titleId = "BE9A" -- Please change this value to your own titleId from PlayFab Game Manager


function init(self)
	local loginRequest = {
		-- https://api.playfab.com/documentation/Client/method/LoginWithCustomID
		TitleId = PlayFabClientApi.settings.titleId,
		CustomId = "GettingStartedGuide",
		CreateAccount = true
	}
	PlayFabClientApi.LoginWithCustomID(loginRequest, OnLoginSuccess, OnLoginFailed)
end


function OnLoginSuccess(result)
	print("works")
end


function OnLoginFailed(error)
	print("no")
end

I tried this code, with client api and got an error to...

HTTP request to 'https://BE9A.playfabapi.com/Client/LoginWithCustomID?sdk=DefoldSdk_0.50.190205' failed (http result: -1 socket result: -5)

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Andy avatar image Andy ♦♦ commented ·

That looks like a problem with the request on the client. Our servers send back normal http status codes. You might one to seek additional help from the defold dev community.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.