# Enabling tokens in Elastic Cloud

**URL:** <https://discuss.elastic.co/t/enabling-tokens-in-elastic-cloud/161881>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security\
**Created:** [December 21, 2018, 5:07pm UTC](https://discuss.elastic.co/t/enabling-tokens-in-elastic-cloud/161881 "2018-12-21T17:07:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mc1392](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@mc1392](https://discuss.elastic.co/u/mc1392)\
**Post date:** [December 21, 2018, 5:07pm UTC](https://discuss.elastic.co/t/enabling-tokens-in-elastic-cloud/161881/1 "2018-12-21T17:07:47Z")

</div>

How do I enable tokens in the Elastic Cloud Service?  
I have a few developers using various clients:

- React
- Java
- PHP

I'd like them to be able to authenticate with user name and password and then receive a token for subsequent requests.

---

<div class="post-metadata">

**Author:** ![ikakavas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ikakavas/32/34430_2.png) [@ikakavas](https://discuss.elastic.co/u/ikakavas)\
**Post date:** [December 24, 2018, 6:17pm UTC](https://discuss.elastic.co/t/enabling-tokens-in-elastic-cloud/161881/2 "2018-12-24T18:17:54Z")

</div>

Hi there,

The token service is enabled for Elastic Cloud. However, note that this cannot be used as a self service API for your users as you describe. Our [Get Token API](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-token.html) implements the [Resource Owner Password Credentials Grant](https://tools.ietf.org/html/rfc6749#section-1.3.3) and as such there needs to be a trusted client that will make authenticated and authorized API calls sending in the end user credentials in order to retrieve an access token ( and potentially a refresh token ) for the end user.

That means that in the example in the docs:

```auto
POST /_xpack/security/oauth2/token
{
  "grant_type" : "password",
  "username" : "test_admin",
  "password" : "x-pack-test-password"
}

```

the `POST /_xpack/security/oauth2/token` request needs to be made by a user ( not necessarily and most probably not the same as the `test_admin` one ) that has the necessary permissions to call that API. The token that this call will return will be for `test_admin` and can be then passed to `test_admin` or used on his behalf.

We are in the process of clarifying the relevant part of the documentation also, apologies if it was not clear enough.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 21, 2019, 6:18pm UTC](https://discuss.elastic.co/t/enabling-tokens-in-elastic-cloud/161881/3 "2019-01-21T18:18:09Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
