Skip to content

extend authstore functionalites #64

@hsedr

Description

@hsedr

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 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions