OAuth 2 Integration

The OAuth 2 Integration enables integrations, where a Client-App can do requests in Smashdocs on behalf on the user. This enables for example getting documents with news or the count of documents with news and show it in any place.

All oauth endpoints are offered by the ORY HYDRA lib, see: https://www.ory.sh/hydra/docs/reference/api#tag/public

Connecting Accounts

Connecting the user Accounts from the Client-App and Smashdocs is the first step.

The Client-App needs to redirect the user to the GET /oauth2/auth endpoint, where the client_id needs to be set in the query parameters.


GET /oauth2/auth

GET Params

response_type: code
client_id: e3b0c44298fc
redirect_uri: https://www.your-app.com/smashdocs/oauth/code
scope: all offline_access

After the connecting process, the oauth lib will redirect back to the redirect_uri containing the code.

Use connected Accounts

After the accounts are connected, the Client-App can get the token from the POST /oauth2/token endpoint.

Any endpoint from the SD-API (not the Partner API) can be called now on behalf of the user.

The figure below shows the flow with fetching the count of documents with news.