I’m a Java beginner trying to use the Duo Admin API to create a user. When I run my code, I get an error saying ‘Missing request timestamp’ with code 40104. Can someone help me figure out what’s wrong?
Here’s a simplified version of what I’m trying to do:
oh yeah, i ran into this same issue. you need to add a ‘Date’ header to your request. it’s a bit tricky, but you gotta format it like RFC 2822. try something like this:
Hey there, I’ve dealt with this Duo API issue before. The problem is that you’re missing a crucial piece in your request - the timestamp. Duo uses this for security reasons.
Finally, add this to your request builder:
.header(“Date”, dateHeader)
This should solve your ‘Missing request timestamp’ error. The Duo API is pretty strict about this timestamp thing, so make sure it’s in the right format (RFC 2822).
Also, a word of advice - always check the API documentation thoroughly. Sometimes these little details can be easy to miss but cause big headaches. Good luck with your project!
The error you’re encountering is due to a missing timestamp in your request. Duo’s API requires a ‘Date’ header for authentication purposes. Here’s how you can modify your code to include it:
Import these additional classes:
java.text.SimpleDateFormat
java.util.Date
java.util.TimeZone
Before creating your HttpRequest, add the following code to generate the date header: