Hi again!
I recently published my add-on on the marketplace, but noticed that many of my users have problems using the add-on correctly.
I could not find any problems on my testing environment, so I created a trial account and installed the add-on directly from the marketplace. There I noticed, that the API endpoint for detailed reports (https://api.clockify.me/report/v1/workspaces/{workspaceId}/reports/detailed) returns a CORS error in PROD (https://api.clockify.me), while it works just fine on the developer API (https://developer.clockify.me).
Thank you for your efforts!
Hello,
Please try using this API call for detailed reports:
https://reports.api.clockify.me/v1/workspaces/{workspaceId}/reports/detailed
Production API’s have a bit different logic than developer ones. You can see the production v1 API docs here: https://docs.developer.clockify.me
I hope this will help.
1 Like
Thank you so much, that solved the issue!
Hello,
As Uros mentioned, the API URLs may differ among different environments and regions.
The recommended approach in this case is to decode and use the claims of the JWT token supplied by Clockify - as ?auth_token query parameter if supplied to the iframe, or authToken field if supplied as part of the installation payload.
This approach also guarantees that the URLs will be the correct ones for the environment/region where the add-on gets installed.
Below is a sample of the URL claims present in the auth token:
"backendUrl": "https://api.clockify.me/api/",
"ptoUrl": "https://pto.api.clockify.me",
"reportsUrl": "https://reports.api.clockify.me",
"locationsUrl": "https://locations.api.clockify.me",
"screenshotsUrl": "https://screenshots.api.clockify.me",
I hope this helps!