auth with password
This commit is contained in:
parent
40065292fb
commit
824276bc07
0
.history/IOT/src/users/login_20230418170045.js
Normal file
0
.history/IOT/src/users/login_20230418170045.js
Normal file
16
.history/IOT/src/users/login_20230418170119.js
Normal file
16
.history/IOT/src/users/login_20230418170119.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
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();
|
16
IOT/src/users/login.js
Normal file
16
IOT/src/users/login.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
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();
|
Loading…
x
Reference in New Issue
Block a user