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
- how think about relationships?
From what I understand, relationships don't work like foreign keys. So, two things: Is the way to simulate foreign keys to manually pass references to IDs? In...
- Appwrite - Github student plan payment
Even though I have the GitHub Student package, I received a notification saying I would be switched to a pay-as-you-go plan. (It said that I could use AppWrite ...
- SMS - Github Student Pack
I have a project on Appwrite Github Student Pack but unable to send any message as I get error: "Phone authentication limit for your organization has exceeded. ...