Currently I am getting an error “Silent sign-in failed” and in my game I get google signing in loop. I know I get this loop because I made that if the silent sign-in fails, it tries to login using regular silent.login(). But I don’t know why my sign in fails? Currently I am bundling my game, and launching it on android device. Do I need to do something else for sign-in to work, or am I doing something completely wrong? My code :
local use_saved_games = sys.get_config("gpgs.use_saved_games") == "1"
function callback(self, message_id, message)
print(message_id)
pprint(message)
if message_id == gpgs.MSG_SIGN_IN or message_id == gpgs.MSG_SILENT_SIGN_IN then
if message.status == gpgs.STATUS_SUCCESS then
print("Good")
end
if message.status == gpgs.STATUS_FAILED then
gpgs.login()
end
if use_saved_games then
gpgs.snapshot_open("googledata", true, gpgs.RESOLUTION_POLICY_MANUAL)
end
if gpgs then
local bytes, error_message = gpgs.snapshot_get_data()
if not bytes then
print("snapshot_get_data ERROR:", error_message)
else
print("snapshot_get_data", bytes)
end
end
end
end
function init(self)
msg.post(".", "acquire_input_focus")
if gpgs then
gpgs.silent_login()
gpgs.set_callback(callback)
end
end
function update(self, dt)
if gpgs then
if self.is_logged_in ~= gpgs.is_logged_in() then
self.is_logged_in = gpgs.is_logged_in()
end
if use_saved_games then
if self.snapshot_is_opened ~= gpgs.snapshot_is_opened() then
self.snapshot_is_opened = gpgs.snapshot_is_opened()
end
end
end
end
function on_message(self, message_id, message, sender)
if message_id == hash("set_data") then
if gpgs then
local success, error_message = gpgs.snapshot_set_data("googledata")
if not success then
print("snapshot_set_data ERROR:", error_message)
end
end
end
end
function final(self)
if gpgs then
gpgs.snapshot_commit_and_close()
end
if gpgs then
gpgs.logout()
end
end
P.S What I have noticed is that on https://github.com/defold/extension-gpgs/blob/master/game.project
in gpgs section there is #client_id so should I paste there my OAuth2 Client ID?
I haven’t done that because in this : https://defold.com/extension-gpgs/ example there are only these fields :
[gpgs]
app_id = 1234567890
use_saved_games = 1
request_server_auth_code = 0
request_id_token = 0