datahub/docs/api/tutorials/references/generate-access-token.md
Hyejin Yoon b526dc1ab6
docs: reformat use case guide toc & api comparison table (#7621)
Co-authored-by: Hyejin Yoon <yoonhyejin@ip-172-30-1-77.us-west-2.compute.internal>
Co-authored-by: Shirshanka Das <shirshanka@apache.org>
Co-authored-by: Hyejin Yoon <yoonhyejin@ip-192-168-0-10.us-west-2.compute.internal>
2023-03-18 13:00:41 -07:00

29 lines
844 B
Markdown

# Generate Access Token
With CURL, you need to provide tokens. To generate token, run the following comand.
```shell
curl --location --request POST 'http://localhost:8080/api/graphql' \
--header 'X-DataHub-Actor: urn:li:corpuser:datahub' \
--header 'Content-Type: application/json' \
--data-raw '{ "query":"mutation { createAccessToken(input: { type: PERSONAL, actorUrn: \"urn:li:corpuser:datahub\", duration: ONE_HOUR, name: \"my personal token\" } ) { accessToken metadata { id name description} } }", "variables":{}}'
```
Expected Response:
```json
{
"data": {
"createAccessToken": {
"accessToken": <my-access-token>,
"metadata": {
"id": <my-id>,
"name": "my personal token",
"description": null
}
}
},
"extensions": {}
}
```
You can now copy `accessToken` and pass it to header.