when creating an account I use following methods:
Future<void> register(String email, String password, String username) async {
final user = await account.create(userId: ID.unique(), email: email, password: password);
await account.createEmailPasswordSession(email: email, password: password);
final userId = UserID(user.$id);
await _createUsername(userId, username);
await _createUser(userId, username);
await getAccount(); // push to stream
}
Future<void> _createUser(UserID userId, String username) async {
// try {
await db.createRow(
databaseId: AppwriteBootstrap.databaseId,
tableId: AppwriteBootstrap.usersCollectionId,
rowId: userId.value,
data: {
'bio': null,
'photoUrl': null,
'username': username,
},
permissions: [
Permission.read(Role.users()),
Permission.update(Role.user(userId.value)),
Permission.delete(Role.user(userId.value)),
],
);
//} catch (_) {
return;
//}
}
Future<Row> _createUsername(UserID userId, String username) async {
return await db.createRow(
databaseId: AppwriteBootstrap.databaseId,
tableId: AppwriteBootstrap.usernamesCollectionId,
rowId: username,
data: {
'user': null
},
permissions: [
Permission.read(Role.any()),
Permission.update(Role.user(userId.value)),
Permission.delete(Role.user(userId.value)),
],
);
}
and _createUsername does work properly, creating the row with the username as id parameter. But when creating the user informations in _createUser, linking it to its relation in usernames, I get the missing authentication error. Same scopes, same restrictions in cloud, everything should be smooth.
If you need me to provide more specific info, @tell me.
Recommended threads
- is `account.get()` safe to be used in th...
I want to user's `id` for authentication. However, a while ago I was told in this server not to use `account.get()` and instead add user preferences for that us...
- Appwrite console is too heavy
The Appwrite console is too heavy And all of my services broken Any support , please
- Usage of the new Client() and dealing wi...
Hey guys, just a quick one - we had some web traffic the other day and it ended up bombing out - To put in perspective of how the app works, we have a Nuxt Ap...