T-DEV-811/IOT/src/users/login.js
2023-04-18 17:31:21 +02:00

16 lines
459 B
JavaScript

import PocketBase from 'pocketbase';
const pb = new PocketBase('https://iot.epi.cb85.software');
const authData = await pb.collection('users').authWithPassword(
'YOUR_USERNAME_OR_EMAIL',
'YOUR_PASSWORD',
);
// after the above you can also access the auth data from the authStore
console.log(pb.authStore.isValid);
console.log(pb.authStore.token);
console.log(pb.authStore.model.id);
// "logout" the last authenticated account
pb.authStore.clear();