GetCurrentUser

Returns the profile object for the user linked to the JSON Web Token, provided in the query or the Authorization header.

Arguments

Copied to clipboard!
func (a *Auth) GetCurrentUser() (*security.User, error)

Return

A pointer to security.User object containing:

Property Type Description
Id
string
The user ID
Content
map[string]interface{}
The user content
ProfileIds
[]string
An array containing the profile ids

Usage

Copied to clipboard!
kuzzle.Auth.Login("local", json.RawMessage("{\"username\":\"foo\",\"password\":\"bar\"}"), nil)
_, err := kuzzle.Auth.GetCurrentUser()
if err != nil {
  log.Fatal(err)
} else {
  fmt.Println("Success")
}