It have to match some minimal security requirements:
if (!token.matches("^[a-zA-Z0-9-]{16,}$")) {
throw new IllegalArgumentException("Illegal token");
}
ahh alright! thanks! i got it to work now!
Greetings, is it possible to send a POST request to create a user with a token parameter? I didn't see this in the traccar API. @Nelio Lucas. Thanks!
It's possible.
Perfect, thanks.
@Nelio Lucas
Would you help me
Unrecognized field "token" (class org.traccar.model.User)
{
"email":"testex@testex",
"name":"testex",
"password":"123123",
"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9xeyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQqNFvYpuwbF6YWbPyaNAGEPw9wbhiQSovvSrD89B8K7Ng"
}
Why are you asking this on a 5 year old thread? Things changed since that time.
I didn't open another topic because as I found this one so as not to duplicate it, honestly I was so happy to be able to send a token in POST that I didn't notice the date of the topic, I need to open a new one or could I let you know if it is still possible and how I could correct it please.
You cannot set the token. The API has been changed and this has been discussed several times. Please search.
I saw Anton, that's why I asked at the beginning if it was possible, unfortunately I just didn't pay attention to the date, my intention from the beginning was to generate the token for another user via the web application, I even managed to do it, but how is it necessary to create the session? The previous user is automatically logged out. Thanks!
Hi, i seem to be having some issues trying to create a user with a token. However if i remove the token field im able to create the the user. the problem is that the token field will remain null.
Here is the error i get when i tried creating a user with the token field using Postman
this is the request url : http://localhost:8082/api/users/
this is the request body
{"name":"Test That","password":"test","email":"test","administrator":true, "token":"dfsdf", "id":-1}