Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web support broken and does not seem to be able to log out even using sessionlogout #105

Open
telostia opened this issue May 6, 2024 · 4 comments
Assignees
Labels

Comments

@telostia
Copy link

telostia commented May 6, 2024

version: latest 1.1.0
flutter version: 3.19.6
dart version: 3.3.4
platform: web
problem: flutter app cannot relog in due to session not able to logged out.
tried solution: 1)tried sessionLogout 2) setting session to null 3) setting client to null 4) setting websocket to null.
result: the nakama server session seems to linger with all the methods tried above
force solution: force refresh the web app will remove server session status.

Is there an more elegant solution to this?

@telostia
Copy link
Author

telostia commented May 6, 2024

this is the code i used :
`Future login(String username, String password) async {
var session = await NakamaClient.getInstance()!
.authenticateEmail(email: username, password: password, create: false);

emit(ApplicationState(session: session, match: state.match));
NakamaWSClient.setSession(session);

}

void logout(Session session) {
try {
var client = NakamaClient.getInstance();
client?.sessionLogout(session: session);
client = null;
} catch (onError) {
print(onError.toString());
}
}`

@telostia
Copy link
Author

telostia commented May 7, 2024

found the culprit... it was the appbar widget that was causing connections to go berserk. somehow placing the login/logout functions here was causing nakama sockets to not show up on the server debug...

@telostia telostia closed this as completed May 7, 2024
@telostia
Copy link
Author

Nope. the issue was due to " await getAccount(session)"... causing an issue for dart client not to relogin.

cause: calling await getAccount(session)
Error: {"code":16,"message":"Server key invalid"}

@telostia telostia reopened this May 12, 2024
@ilmalte
Copy link
Collaborator

ilmalte commented Oct 22, 2024

Hey @telostia thanks for reporting this issue.
Many improvements and bug fixes have been pushed to main since the version 1.1.0, and they will be released soon.
You might want to try to update your pubspec.yaml file to point directly to main for now:

dependencies:
  nakama:
    git:
      url: 'https://github.com/heroiclabs/nakama-dart.git'
      path: nakama

I am not certain if this will resolve your issue, so I will attempt to reproduce it on my machine and will keep you updated.

@ilmalte ilmalte added type: bug Something isn't working status: needs information labels Oct 22, 2024
@ilmalte ilmalte self-assigned this Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants