Using OAuth2 with the HotDocs Hub
OAuth2 is an authorization framework that allows a third-party application to access a web service. Enabling OAuth2 for the HotDocs Hub allows you to access Hub resources from your own application, without requiring users to enter an additional username and password.
In this Topic Hide
Security
All OAuth2 requests to HotDocs Hub must be sent using TLS/SSL.
Identity Server
HotDocs Hub uses ThinkTecture Identity Server to authenticate and authorize requests to Hub APIs. When the Hub is configured to use authentication, all requests made to the API must be signed with an Access Token generated by Identity Server. Identity Server is installed with the HotDocs Hub by default.
Steps for making a OAuth2 request to HotDocs Hub
To make a request to a HotDocs Hub API using OAuth2 for authentication, you must use the following steps:
- Register your application with HotDocs Hub
- Retrieve an Access Token from Identity Server
- Make an authenticated request to the HotDocs Hub API using the Access Token
2. Retrieve an Access Token from Identity Server
Once your application is registered, you can begin to send requests to HotDocs Hub. Any request to the Hub must contain an access token, used to authenticate requests to the Hub APIs. Access Tokens are generated by Identity Server, using the Token endpoint.
Token Endpoint
To generate an access token, use the Token endpoint for Identity Server.
HTTP Request
POST https://{machine-name}/hotdocsidentityserver/core/connect/token
Parameters
See the Token endpoint documentation for all required request parameters.
Example URL
https://hubserver/hotdocsidentityserver/core/connect/token
Example Response
{"access_token":"eyJ0eXAiOiLKN1QiLcJfbGciOiJSUzI1NiIsIng1dCI6ImEck1RZ01Gdjl0UGNsTGE2eUYzekFrZnF1RSIsImtpZCI6ImEzck1WS01Gdjl0UGNsTGE2eUYzekFrZnF1RSJ9.eyJjbGllbnRfaWQiOiJVcGxvYWRQbHVnaW4iLCJjbGllbnRfdGVuYW50aWQiOiIwZGQ3ZDgwNi1lNzgyLWU1MTEtODI4MC0yYzQ0ZmQxYTVlMjQiLCJjbGllbnRfdGhJZERiIjoiZDliNWEwOTUtMjM4Mi1lNTExLTgyODAtMmM0NGZkMWE1ZTI0IiwiY2xpZW50X2luSWREYiI6ImRhYjVhMDk1LTIzODItZTUxMS04MjgwLTJjNDRmZDFhNWUyNCIsImNsaWVudF9wZUlkRGIiOiJkYmI1YTA5NS0yMzgyLWU1MTEtODI4MC0yYzQ0ZmQxYTVlMjQiLCJzY29wZSI6IlRlbXBsYXRlSHViQVBJIiwiaXNzIjoiaHR0cHM6Ly9lZHYwMjIwMTJzaW1vbi9Ib3REb2NzSWRlbnRpdHlTZXJ2ZXIvY29yZSIsImF1ZCI6Imh0dHBzOi8vZWR2MDIyMDEyc2ltb24vSG90RG9jc0lkZW50aXR5U2VydmVyL2NvcmUvcmVzb3VyY2VzIiwiZXhwIjoxNDQ4NDc0NDA2LCJuYmYiOjE0NDg0NzA4MDZ9.BmZ2cm6Cv-g5dlUsrxOrmbEvjrYRPsy2lYkFfS6i2lSVvzvRfbXzuXdeofmBcbEQsAK86Q75c5Oz7UTu7bwWhZ_3m2p2yhN-lRG747q495smWyenm3sm5zlw5PFpsqLfpu2hSiruuWZDo_Dw6oFLivVQ-o-qabrrI7Ioc9EVPU0lzbIMZHqJXopeVmKXTMgR1rF_JKlN-eMqc5iBffR-yl5-VILlzl1SIwlNg6OmS98_Kc5at5rTRhh7BfSalrcmvu-AsueLu94a81leGcly5K14F8FKcUCSrcbvj1q9K1Z82t-U8r9v6GWljvV5paWbATEjx9D2hMWenM7xtDXwbA","expires_in":3600,"token_type":"Bearer"}
3. Make an OAuth2 Authenticated Request to HotDocs Hub APIs
To make an authenticated request to the HotDocs Hub, use the access token when sending a request to one of the HotDocs Hub API endpoints.