After it took me a while to realize that if my gpgs.silent_login()
fails, I should call gpgs.login()
or something like that (should I?), I got myself signed in but calling gpgs.get_id_token()
returns nil. I need the id token to authenticate with my Supabase-based backend for some stuff. I set up game.project
properly, I believe.
game.project:
[gpgs]
app_id = <I put my app number here>
use_saved_games = 0
request_server_auth_code = 0
request_id_token = 1
client_id = somethingsomethingsomething.apps.googleusercontent.com
login code (for now in main.script):
function init(self)
local tried_login = false
print("HELLO!!!!")
local function gpgs_callback(self, message_id, 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("Signed in")
print(gpgs.get_id())
print(gpgs.get_display_name())
print(gpgs.get_id_token()) -- print nil :(
else
print("Sign in error!")
print(message.error)
if not tried_login then
tried_login = true
gpgs.login()
end
end
elseif message_id == gpgs.MSG_SIGN_OUT then
print("Signed out")
end
end
if gpgs then
gpgs.set_callback(gpgs_callback)
gpgs.silent_login()
else
print("No gpgs")
end
end
Additionally, I’m not sure if I should put my Android GCP Credentials Client ID or GcP Web Credentials Client ID for the client_id. Anyone has a clue?