Token Expiration Date not Taking

Cybermedica year ago

When I change the token expiration to be something longer then 7 days it is not taking. I go back in, and the original date comes up and not the new date. I do it save, but it isn't saving. Anybody have an idea why this is happening? Thanks

Anton Tananaeva year ago

Are you sure you're using the latest version? Please provide a screen recording.

Cybermedica year ago

Version: 5.5

{"id":1,"attributes":{"speedUnit":"mph","distanceUnit":"mi","volumeUnit":"usGal","timezone":"America/New_York"},"registration":false,"readonly":false,"deviceReadonly":false,"map":"","bingKey":"","mapUrl":"","overlayUrl":null,"latitude":43.078175,"longitude":-77.414831,"zoom":13,"twelveHourFormat":false,"forceSettings":false,"coordinateFormat":"","limitCommands":false,"disableReports":false,"fixedEmail":false,"poiLayer":"","announcement":null,"emailEnabled":true,"geocoderEnabled":true,"storageSpace":[1845067776,8249614336],"version":"5.5"}

Changed on iOS app and web . . . didn't stay.

Cybermedica year ago

Still cannot get the token expiration to take on version 5.5. Looking for any suggestions. Thanks

Anton Tananaeva year ago

What about the screen recording?

Cybermedica year ago

Sorry. I’m not sure what you are looking for with that. Please explain.

Anton Tananaeva year ago

Screen recording for retrieving and using the token.

Cybermedica year ago

I attempted to do a video, but the calendar part did not show on video. What I am doing is not that complicated.

Open Traccar
Go to Settings
Go to Preferences (Token)
Change Date from 1/18/2023 to 12/31/2040.
Show Token . . . copy Token (Email it to First Arriving to publish on our Dashboard)
Click “Save” in Traccar
Done

Go back into Traccar and check Token expiration. The Expiration Date = 1/18/2023 (Token equals 1/18/2023 and not 12/31/2040).

Trying to get the Token to last more than 7 days, so we are not constantly sending Tokens to First Arriving to keep our Dashboard up to date.

Anton Tananaeva year ago

How did you pick the date? Type it or select in the pop-up?

Cybermedica year ago

Clicked on calendar icon
Clicked on “January 2023”
Scrolled down and picked year
Then picked Month
Then picked Day

(Did not type it but had tried that way too with no luck)

Anton Tananaeva year ago

When I tested I think I picked about a month ahead and it worked for me. Not sure what the issue is in your case.

Cybermedica year ago

Hmmm. I tried a month; I tried just a day, and I tried a year. Nothing takes. Weird.

Anton Tananaeva year ago

Have you tried the latest source code?

Mega Box Brasila year ago

I seem to be having the same problem, so I decided not to open a new topic.

In Traccar 5.6, after creating a session and obtaining the JSESSIONID Cookie from the session to create a Token, the call is made without errors, but it does not accept the expiration date that I set.

I am making the call like this (I saw it in a topic here, as it is not yet updated in the documentation):

http://[myIp]:[port]/api/session/token?userId=3&expiration=2024-01-01T00:00:00Z

The call is successfully made without error messages, but the expiration date that I set is not respected. By default, it puts +7 days.

I have tried several date formats, JSON, ISO, ISO 8601, and I have also tried passing the date in the header, as JSON, and formatting it for URL encoding, but none of these attempts have worked.

I know it has recently changed and that is why it is not yet in the documentation. Many users are having doubts about the Token.

How can I set a longer expiration date for my token? Can I set an expiration date with the JSESSIONID Cookie or should I use the Token for that?

My API call response:

Method: POST

http://[myIp]:[port]/api/session/token?userId=3&expiration=2024-01-01T00:00:00Z

headers

Content-Type = application/x-www-form-urlencoded
Cookie = JSESSIONID=node0e9xxxxxxxxxxxxxxxx.node0

call result

{
    "body": {},
    "error": {
        "status_code": 200,
        "status_message": "OK",
        "body": "\"MYTOKEN\""
    },
    "returned_an_error": false,
    "headers": {
        "date": "Fri, 24 Mar 2023 08:08:10 GMT",
        "content-type": "application/json",
        "access-control-allow-headers": "origin, content-type, accept, authorization",
        "access-control-allow-credentials": "true",
        "access-control-allow-methods": "GET, POST, PUT, DELETE, OPTIONS",
        "access-control-allow-origin": "*",
        "content-length": "154",
        "server": "Jetty(10.0.13)"
    }
}

Everything is fine except the date, regardless of what format I put it in, or even if I put it in the header or body of the json, etc.

Thank you very much!

Anton Tananaeva year ago

Where do you see the expiration date?