SDK
SDK Golang v1.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

GetCurrentUser #

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

Arguments #

func (a *Auth) GetCurrentUser() (*security.User, error)

Return #

A pointer to security.User object containing:

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

Usage #

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")
}