SDK
SDK Golang v2.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.

CheckToken #

Checks the validity of an authentication token.

Arguments #

func (a *Auth) CheckToken(token string) (*TokenValidity, error)
ArgumentsTypeDescriptionRequired
token
string
the tokenyes

Return #

A TokenValidity struct which contains:

NameTypeDescription
Valid
boolean
Tell if the token is valid or not
State
string
Explain why the token is invalid
Expires_at
int
Tells when the token expires

Usage #

jwt, _ := kuzzle.Auth.Login("local", json.RawMessage("{\"username\":\"foo\",\"password\":\"bar\"}"), nil)
res, err := kuzzle.Auth.CheckToken(jwt)
if err != nil {
  log.Fatal(err)
} else {
  if res.Valid != true {
    log.Fatal("Invalid token")
  }
  fmt.Println("Success")
}