Shelly Schwartzer
03/22/2026, 4:36 PMmgmt.jwt.impersonate() to issue a JWT on behalf of a user (for MDM zero-touch login). This returns only a session JWT (no refresh token). We need the user to stay authenticated for days/weeks without interactive login.
1. Is mgmt.jwt.signIn() the right approach for server-side authentication that returns both sessionJwt + refreshJwt? Does it work with a selectedTenant?
2. Is there a way to get a refresh token from mgmt.jwt.impersonate()? The refreshDuration parameter exists on the API -- does it cause a refresh token to be returned?
3. What's the recommended pattern for machine/daemon authentication where a backend needs to issue long-lived tokens for a user without interactive login (the MDM/zero-touch use case)?DevRev
03/22/2026, 4:37 PMmgmt.jwt.impersonate() method returns only a session JWT by design . The refreshDuration parameter sets the JWT validity period but doesn't generate a refresh token .
For your MDM zero-touch use case requiring days/weeks of authentication, consider these approaches:
Option 1: Use M2M Authentication
// Client credentials flow for machine authentication
const response = await fetch('<https://api.descope.com/oauth2/v1/token>', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({
grant_type: 'client_credentials',
client_id: 'your-access-key-id',
client_secret: 'your-access-key-secret'
})
});
This returns both access and refresh tokens for machine-to-machine scenarios .
Option 2: Extend Impersonation Duration
// Set longer refreshDuration for impersonation JWT
const resp = await descopeClient.management.jwt.impersonate(
loginId,
impersonatorId,
false, // validateConsent
customClaims,
selectedTenant,
2592000 // 30 days in seconds
);
Recommended Pattern for MDM/Zero-Touch
For backend services issuing long-lived tokens without interactive login, use Descope Access Keys with client credentials flow . This provides proper refresh token support and is designed for automated processes .
The mgmt.jwt.signIn() method isn't documented in the available resources, suggesting it may not be the standard approach for server-side authentication.
Impersonate User | API Reference | Descope Documentation
M2M Security | Descope Documentation
Inbound Apps | Descope DocumentationKevin Gao
03/22/2026, 4:41 PMKevin Gao
03/22/2026, 4:41 PMKevin Gao
03/22/2026, 4:41 PMShelly Schwartzer
03/22/2026, 4:50 PMMgmtLoginOptions accepts — specifically whether it has a selectedTenant field so the JWT is scoped to the right tenant?Kevin Gao
03/23/2026, 4:56 PMShelly Schwartzer
03/23/2026, 5:09 PMShelly Schwartzer
03/23/2026, 5:09 PMShelly Schwartzer
03/23/2026, 5:10 PMShelly Schwartzer
03/23/2026, 5:18 PMShelly Schwartzer
03/24/2026, 12:01 PMShelly Schwartzer
03/24/2026, 4:14 PMShelly Schwartzer
03/24/2026, 6:14 PMMeir Wahnon
03/24/2026, 6:17 PMBhagwanta Yeole
03/24/2026, 9:09 PMShelly Schwartzer
03/25/2026, 7:47 AMBhagwanta Yeole
03/25/2026, 9:11 AMChris Carper
03/25/2026, 1:54 PMShelly Schwartzer
03/25/2026, 2:09 PM