Closed Dragon863 closed 11 months ago
Thank you @Dragon863 for reporting. I am just back from vacation and checking in your issue shortly.
Hi I am getting the same! Auth token always invalid. Any progress?
This error is occuring because there is no token sended by the client. There is an options parameter in the methods that make GRPC calls and a method to prepare session as token
Just add this line on the methods that you want
Bump :)
edit: I was facing the same issue while authenticating and using the token for creating a group. I confirm @taciomedeiros solution helped me fix this issue.
in session.dart
expiresAt: DateTime.fromMillisecondsSinceEpoch(
(token['exp'] as int) * 1000,
),
refreshExpiresAt: DateTime.fromMillisecondsSinceEpoch(
(refreshToken['exp'] as int) * 1000,
),
in nakama_grpc_client.dart
final res = await _client.createGroup(api.CreateGroupRequest(
name: name,
avatarUrl: avatarUrl,
description: description,
langTag: langTag,
maxCount: maxCount,
open: open,
),
options: _getSessionCallOptions(session),
);
Token parsing issue and missing options fixed in next release (releasing today)
Hi there! Thanks for the useful package, unfortunately I'm running into two issues. Firstly, the timestamps for the session expiry seem to be reported incorrectly (at some point in 1970), I believe this is because in
session.dart
fromMillisecondsSinceEpoch
is being called on the decoded token which stores the token in seconds since epoch. Whilst this can be worked around by changing the arguments to(token['exp'] as int) * 1000
in every line where this function is called in the file, I am still getting the message "Auth token invalid" when using any function with the session object (for example addFriends). I'm not sure if this is an issue with the package or the server I'm running, but I thought it could be relevant or maybe caused by the first issue.I used the official docs and logged using email and then attempted to add a friend to the account using the following:
This gives the following output:
After applying the fix I mentioned above the session is reported as expiring at the correct date, but the second error still occurs.
I am using flutter 3.13.0 and the latest version of this ibrary on pub.dev, and the latest docker image of nakama. Thank you in advance!