Generate Auth Tokens

BASIC AUTH TOKEN USING BASE64

Basic Auth Token on Python

>>> string = 'user:password'
>>> data = base64.b64encode(string.encode())
>>> print(data)
b'ZGF0YSB0byBiZSBlbmNvZGVk'

Basic Auth Token on Linux

$ echo -n 'user:pass' | base64
ZGF0YSB0byBiZSBlbmNvZGVk

BEARER TOKEN

$ curl -XPOST /_xpack/security/oauth2/token -H "Content-Type: application/json" --data
'{
  "grant_type" : "password",
  "username" : "username",
  "password" : "my-password"
}'