How can I obtain a pocketbase token and how to use it to view, add, modify and delete records by accessing the API and using the appinventor web component and the post method by sending username and password in the body of the request?
?
make use of this, it has clear docs
Thank you all. Yes, pocketbase has very clear documents. I have the project hosted on pockethost. The question is about appInventor and the web component. To obtain a list of records from a table with web1.get I have my data, but to make a post that recovers the token I have not been able to implement it.
I must include the username and password in the body of the request, but I don't know how to do it. I don't find the appropriate way.
Thanks in advance.
In postText use make a dictionary block,
And put identity in key area and its value, similar for password
identity - username/email
password - password
Thanks for your support.
Result: {code":404,"message":"Not Found.","data":{}}
With apidog it works, query result:
{
"record": {
"avatar": "x_min_ZbwtO8vY7Z.jpg",
"collectionId": "pb_users_auth",
"collectionName": "users",
"created": "2023-06-15 22:12:45.954Z",
"email": "x@gmail.com",
"emailVisibility": false,
"id": "72pm6rokr8qrvcg",
"name": "x",
"updated": "2024-04-11 02:25:49.150Z",
"username": "users45634",
"verified": true
},
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb3xsZWN0aW9uSWQiOiJfcGJfdXNlcnNfYXV0aF8iLCJleHAihjE3MTQzNjE3MjIsImlkIjoiNzJwbTZyb2tyOHFydmNcIiwidHlwZSI6ImF1dGhSZWNvcmQifQ.v4Wh3F_F8CVSSOh61iKIFVXsMERfStPpxx2Xo3pjM2k"
}
Can someone help me?
Thank you Taifun. Are we omitting something?
URL: https://x.pockethost.io/api/collections/users/auth-with-password
Result: {"code":404,"message":"Not Found.","data":{}}
Show us the working request
Taifun
Hmmm, in the docs it says:
Body parameters could be sent as JSON or multipart/form-data.
I wonder if it is expecting multpart/form-data? The web component cannot send this....
Apidog parameters
POST https://x.pockethost.io/api/collections/users/auth-with-password
Headers:(8)
Cache-Control <calculated when request is sent
Cookie <calculated when request is sent
Host <calculated when request is sent
User-Agent Apidog/1.0.0 (https://apidog.com)
Accept /
Accept-Encoding gzip, deflate, br
Connection keep-alive
Content-Type application/json
{
"identity": "x@gmail.com",
"password": "1234567890"
}
Is PonerTexto equivalent with the PostText method? Or did you use PutText?
switching the language to English before taking a screenshot could help to avoid misunderstandings...
your blocks look fine...
you can try to send this as plain text as you tried previously
{
"identity": "[x@gmail.com](mailto:x@gmail.com)",
"password": "1234567890"
}
but this time don't forget the double quotes...
Taifun
Oh, if it's a translation problem, I was using the wrong block: PutText .
Thank you so much everyone.
Taifun you are a genius, thanks again.