"Refresh token not valid"
Problem reported by Somo IT - 7/16/2026 at 3:55 AM
Resolved
Hello

I want to develop an integration with the smartermail API and im testing the authentication and refresh tokens.

Authentication works good but there is no way to make refresh tokens work.  Its a clean testing installation of smartermail via docker-compose. Admin, domain and testing user newly created, but:

$ curl -s -X POST hxxp://192.168.100.100:8080/api/v1/auth/authenticate-user -H "Content-Type: application/json" -d '{"username":"test@mydomain.com","password":"mypassword"}'

{"emailAddress":"test@mydomain.com","changePasswordNeeded":false,"passwordExpired":false,"displayWelcomeWizard":true,"isAdmin":false,"isDomainAdmin":false,"isLicensed":true,"isClusterAdmin":false,"autoLoginToken":"","autoLoginUrl":"","localeId":"en","requirements":null,"suppressIdsTick":false,"isImpersonating":false,"canViewPasswords":false,"accessToken":"eyJhbG...CEcQ","refreshToken":"eyJhbGciOiJS...4mIfD4-Dew","accessTokenExpiration":"2026-07-16T10:47:06.9923367Z","refreshTokenExpiration":"2026-09-14T10:32:07.0000397Z","username":"test@mydomain.com","success":true,"resultCode":200}


$ curl -s -X POST hxxp://192.168.100.100:8080/api/v1/auth/refresh-token -H "Content-Type: application/json" -d "{\"token\":\"eyJhbGciOiJS...4mIfD4-Dew\"}"
{"isImpersonating":false,"canViewPasswords":false,"accessToken":"","refreshToken":"","accessTokenExpiration":null,"refreshTokenExpiration":null,"username":null,"success":false,"resultCode":401,"message":"Refresh token not valid"}

I have tried many times, the token is perfectly pasted (if i modify a char it returns signature validation error), i have also used the isWebmailRefresh parameter but no luck, tried two different versions of smartermail... out of ideas.

Can you help me?

Thanks in advance!!



Larry Duran Replied
Employee Post
Hello Somo, make sure to not include the refresh token in the authorization header.  It's an anonymous endpoint that takes the refresh token as part of the JSON payload, but you should not include it with the "authorization: Bearer TOKEN" header.

Any token passed into the authorization header gets evaluated as an auth token so any refresh token used gets rejected as not valid.
Larry Duran
Product Manager 
SmarterTools Inc.
www.smartertools.com 
Somo IT Replied
Thanks for your help, Larry!

Anyway, curl does not send the Authorization headers unless you add it in the headers parameter.

These are the headers it sends in the tests im doing:

* Connected to 192.168.100.100 (192.168.100.100) port 8080
* using HTTP/1.x

> POST /api/v1/auth/refresh-token HTTP/1.1
> Host: 192.168.100.100:8080
> User-Agent: curl/8.14.1
> Accept: */*
> Content-Type: application/json
> Content-Length: 828


Does this work (authentication api call + refresh-token api call) via postman, curl, python  or any other method for anyone?

Thanks!
Somo IT Replied
Marked As Resolution
Solved. The problem was that it is necessary to send a "clientid" in the authenticate-user call payload
Larry Duran Replied
Employee Post
Oh yes that is also needed to persist the refresh tokens.  I'll submit a bug report to include that information in our API documentation.
Larry Duran
Product Manager 
SmarterTools Inc.
www.smartertools.com 
Somo IT Replied
It is mentioned in the AuthenticateUser  (
(http...  ...  /Documentation/api#/reference/SmarterMail.Web.Api.AuthenticationController/AuthenticateUser/post):

"clientId": text,// A unique identifier for the client application. Required at login to enable token refresh. Tokens obtained without a clientId are valid for 15 minutes and cannot be refreshed.

Larry Duran Replied
Employee Post
Thanks.  I want to also get it in the auth section here.
Larry Duran
Product Manager 
SmarterTools Inc.
www.smartertools.com 

Reply to Thread

Enter the verification text