Closed GPortas closed 1 month ago
:package: Pushed preview images as
ghcr.io/gdcc/dataverse:10857-add-expiration-date-to-recreate-token-api
ghcr.io/gdcc/configbaker:10857-add-expiration-date-to-recreate-token-api
:ship: See on GHCR. Use by referencing with full name as printed above, mind the registry name.
:package: Pushed preview images as
ghcr.io/gdcc/dataverse:10857-add-expiration-date-to-recreate-token-api
ghcr.io/gdcc/configbaker:10857-add-expiration-date-to-recreate-token-api
:ship: See on GHCR. Use by referencing with full name as printed above, mind the registry name.
@GPortas Hey - can you please update the pull request with the latest from develop.
:package: Pushed preview images as
ghcr.io/gdcc/dataverse:10857-add-expiration-date-to-recreate-token-api
ghcr.io/gdcc/configbaker:10857-add-expiration-date-to-recreate-token-api
:ship: See on GHCR. Use by referencing with full name as printed above, mind the registry name.
Tested in Internal - no issues found
omerfahim@HMDC-HMDCs-MacBook-Pro dataverse % curl -H "X-Dataverse-key:5a6185e1-e0a2-4b7e-b6a6-62da5b854e22 " -X POST "https://dataverse-internal.iq.harvard.edu/api/users/token/recreate?returnExpiration=true" {"status":"OK","data":{"message":"New token for SmokeTest24 is a3d27fc6-5000-49d4-ac94-ff4cbeef0e50 and expires on 2025-10-02 13:38:25.443"}}%
Was testing again today and noticed that the Expiration date on the UI doesn't match up with the expiration date on the API call. - This is likely due to the UI following EST timezone and API using UTC timezone.
What this PR does / why we need it:
An optional query parameter called 'returnExpiration' has been added to the 'users/token/recreate' endpoint, which, if set to true, returns the expiration time in the response message.
Which issue(s) this PR closes:
Special notes for your reviewer:
I've kept the string messages as responses for backward compatibility, although it would be interesting to use JSON responses in the future, as multiple properties are being returned in the same response message.
Suggestions on how to test this:
For obtaining a new token without its expiration time (current behavior)
curl -H "X-Dataverse-key:$API_TOKEN" -X POST "$SERVER_URL/api/users/token/recreate"
This endpoint by default will return a response message indicating the user identifier and the new token.For obtaining a new token with its expiration time
curl -H "X-Dataverse-key:$API_TOKEN" -X POST "$SERVER_URL/api/users/token/recreate?returnExpiration=true"
Does this PR introduce a user interface change? If mockups are available, please link/include them here:No
Is there a release notes update needed for this change?:
Yes, attached.
Additional documentation:
No