Documentatie/Create-access-token.md

26 lines
3.3 KiB
Markdown
Raw Normal View History

2020-04-17 14:08:10 +00:00
# Get an access token
This page explains how to get an access token, this token needs to be sent along when sending requests to the REST API.
Please follow the steps below
1. Go to the swagger documentation: [https://farmmaps.awacc.nl/swagger/index.html](https://farmmaps.awacc.nl/swagger/index.html)
2. Click "Authorize" and check the "Scopes" checkbox, click authorize again.
3. You will now be redirected to the FarmMaps OpenID login form, enter your details (akkerweb account, acceptation or test) and login.
4. Once logged in, you will automatically be redirected back to swagger again.
5. Close the "Available authorizations" popup.
6. Expand one of the items listed, for example "CodeListItem".
7. Click "Try it Out" and then "Execute"
8. Under "Responses" the curl command lists the access token after `-H "Authorization: Bearer `:
```
curl -X GET "https://farmmaps.awacc.nl/api/v1/codelistitems" -H "accept: application/json" -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IkNERkM3M0I0NzY0Q0M5RTYxQTVDRjg3OEM5MDlFRUU0ODFFODk5MzEiLCJ0eXAiOiJhdCtqd3QiLCJ4NXQiOiJ6Znh6dEhaTXllWWFYUGg0eVFudTVJSG9tVEUifQ.eyJuYmYiOjE1ODcxMzE4ODMsImV4cCI6MTU4NzEzNTQ4MywiaXNzIjoiaHR0cHM6Ly9hY2NvdW50cy5mYXJtbWFwcy5hd2FjYy5ubCIsImF1ZCI6ImFwaSIsImNsaWVudF9pZCI6ImZhcm1tYXBzYWNjX3N3YWdnZXIiLCJzdWIiOiJtYWlsdG86YXVrZUBzaW1wZWx3ZWJkZXNpZ24ubmwiLCJhdXRoX3RpbWUiOjE1ODcxMzE4ODIsImlkcCI6ImxvY2FsIiwic2NvcGUiOlsiYXBpIl0sImFtciI6WyJwd2QiXX0.HOnc6ohPFljzPRXMpDnDMXlmlYCb5SBrNB3OMrpjAGx_TSES-ZJ8QuOwyeVLEn4LG0USkMzKZpR4MGAZvkN-5CgLu2unFWHjVBU_tY16QBg7pOnd-ZdXbMojINFk05EIFXEL2vBMWV1i3pxQVFK3jb7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