-
Notifications
You must be signed in to change notification settings - Fork 20
Authentication
Martin Brocker edited this page Aug 5, 2019
·
1 revision
WIP ...
Enable JWT authentication middleware by including the following configuration in your config file:
"authentication": {
"type": "jwt",
"jwt": {
"secret": "my secret"
}
}
Generate an API token:
$ ./scripts/generate-api-token --service-name "My Service" --admin-email [email protected] --secret "my secret"
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZXJ2aWNlIjoiTXkgU2VydmljZSIsImVtYWlsIjoiYWRtaW5AbXktc2VydmljZS5vcmciLCJ0eXBlIjoic2VydmljZSIsImlhdCI6MTUzMjQyNjg2NywiaXNzIjoiSGVhcnRoIn0.bQomDjWkwSrTyYAiX917kiKZvbsh9httwqRGEMvqZak
Include the Authorization
header in Hearth API calls with the Bearer token set to the token output by the script:
curl -X GET \\
https://myhearth.org/fhir/Person/222222 \\
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZXJ2aWNlIjoiTXkgU2VydmljZSIsImVtYWlsIjoiYWRtaW5AbXktc2VydmljZS5vcmciLCJ0eXBlIjoic2VydmljZSIsImlhdCI6MTUzMjQyNjg2NywiaXNzIjoiSGVhcnRoIn0.bQomDjWkwSrTyYAiX917kiKZvbsh9httwqRGEMvqZak"