I am running into a problem with session management in the Godot 4 client library that seems inconsistent with the session restoration and refresh token handling in other libraries, such as Unity and Unreal.
After authentication, both the auth_token and refresh_token are present, and I save them locally on the user's device. According to the session lifecycle documentation at Nakama Godot Client Library Docs, using NakamaClient.restore_session(auth_token) should restore a session. However, this method returns a NakamaSession instance without a refresh_token. If the session is expired, the next part of the example await client.session_refresh_async(session) fails with a Refresh token is required error.
Based on the body of the restore_session function and the counterpart functions in other client libraries, to workaround this, I've directly instantiated the session with both tokens: var session = NakamaSession.new(auth_token, refresh_token). This approach seems to work correctly.
Am I headed in the right direction with this or is it not meant to work this way? I've just started with Nakama and multiplayer in general, so I'm not really certain what to expect or look for.
I am running into a problem with session management in the Godot 4 client library that seems inconsistent with the session restoration and refresh token handling in other libraries, such as Unity and Unreal.
After authentication, both the
auth_token
andrefresh_token
are present, and I save them locally on the user's device. According to the session lifecycle documentation at Nakama Godot Client Library Docs, usingNakamaClient.restore_session(auth_token)
should restore a session. However, this method returns aNakamaSession
instance without arefresh_token
. If the session is expired, the next part of the exampleawait client.session_refresh_async(session)
fails with aRefresh token is required
error.Based on the body of the
restore_session
function and the counterpart functions in other client libraries, to workaround this, I've directly instantiated the session with both tokens:var session = NakamaSession.new(auth_token, refresh_token)
. This approach seems to work correctly.Am I headed in the right direction with this or is it not meant to work this way? I've just started with Nakama and multiplayer in general, so I'm not really certain what to expect or look for.