Right now one cannot access the data, which pocketbase sends back when the authentication was successful.
Solution
The solution is to extend the authResponse-struct, such that the record/admin field of the JSON-Response is parsed into it. The data could be exposed by a function which takes in a struct and maps the data.
// after authentication
type Record struct {
ID string `json:"id"`
Username string `json:"username"`
Email string `json:"email"`
...
}
var record Record
client.AuthStore().Model(&record)
I think that the providing the struct from outside is the right choice here because the response could contain custom fields.
Which part of the project should be enhanced?
Auth-Store
Description of the problem.
Right now one cannot access the data, which pocketbase sends back when the authentication was successful.
Solution
The solution is to extend the
authResponse
-struct, such that therecord/admin
field of the JSON-Response is parsed into it. The data could be exposed by a function which takes in a struct and maps the data.I think that the providing the struct from outside is the right choice here because the response could contain custom fields.