Closed pelletier197 closed 2 years ago
As I stated in the PR, I modified an Integer to a Double. Do you consider this to be an issue? If yes, to you have an alternative to propose to still have the possibility to use a Double
as the sessionLifetime
?
👋 Hi @pelletier197, thanks for the PR.
I looked at the schema of the tenants API, and the session_lifetime
and idle_session_lifetime
are defined as integers. When I tried updating the settings using a double (e.g., 75.5), I get a 400
error:
{
"statusCode": 400,
"error": "Bad Request",
"message": "Payload validation error: 'Expected type integer but found type number' on property idle_session_lifetime (Number of hours for which a session can be inactive before the user must log in again).",
"errorCode": "invalid_body"
}
We should add support for idle_session_lifetime
, but I think it should be an integer. Did you get a successful response when updating a tenant with a double value? If so, what value?
Regarding the change from Integer
to Double
, it may be a moot point based on the above, but as you noted it would be a breaking change and so we shouldn't do it in the current release. We can identify a different approach to prevent a breaking change, but first let's figure out if it even can/should be a double.
Thanks!
@jimmyjames That is quite strange. I get the same error as you now. I swear that this code worked 2 days ago :thinking: :thinking: :thinking: :thinking:
What is even weirder is that, in the UI, when you go in the Dashboard > Settings > Login Session Management
(Notice, the time is in minutes in the UI, but in hours in the API :shrug: ). If you try to go in the UI and save the settings in minutes, then call the API to fetch tenant settings, you'll see a response in double...
This is the answer I get when I call the management API:
"idle_session_lifetime": 0.5,
"session_lifetime": 12,
But you are right, you are only able to do the PATCH with an int.. Feels like the issue is on the Auth0 API then, wouldn't it? Now here's what I propose:
I will keep integer for now, but receiving 0.5 will turn it to 0, which doesn't quite make sense.
And you can check on your side what's wrong with this API in the meantime I guess.
I still won't be able to use the API cause I need the timeout to be 30 minutes to respect our pen-tester recommendations, but we did it manually in the UI for now..
Thanks a lot!
Thanks @pelletier197, yes I see the same behavior you are reporting. It is confusing 😕
Sometimes the dashboard will use non-public APIs; that may be what's happening here. It is unfortunate that the API will return a double when the lifetime is set through the UI to be fractions of hours, but I think your assessment of keeping it an int aligns with the public API and is probably the best we can do for now. I'll think about it a bit then review the specific changes.
Thanks for raising and providing all the details 🙇
@poovamraj would you mind reviewing this PR while I'm out? As you can see from the conversation, there is a discrepancy between the API behavior and the dashboard UX. Given that the API only works in whole hours, I think adding support for the session idle lifetime as an integer makes sense.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you have not received a response for our team (apologies for the delay) and this is still a blocker, please reply with additional information or just a ping. Thank you for your contribution! 🙇♂️
@jimmyjames any news ? I don't really need this much anymore, but any reason not to merge it? Otherwise, I'll close it. Thanks!
Hey @pelletier197, apologies for the delay while I was away. I'm going to look into this again this week and see if this change is something we can do, or if it's something we can't adequately address in the SDKs. Thanks!
Changes
int
todouble
, it's a breaking change. A pretty small one, but still.References
Here is an example on my tenant that session lifetime and idle session lifetime can be double
Testing
Sample code
Should output
Checklist