Auth0 Home Blog Docs

Device name for Resource Owner Password flow (Java)



I am using the auth0-java library and want to generate refresh tokens using the offline_access scope

If authentication succeeds the token will show in the dashboard user -> devices tab correctly (counter will increment)

However I cannot figure out how to specify the “name” shown there. Using the java API it will always be “okhttp”. Doing some testing it seems like it is always the “user-agent” http header that is taken as device name (i.e. I can force a different name by specifying a different “user-agent”)

Using the legacy API it was possible to specify this name using the “device” parameter but this does not seem to have any effect anymore (i.e. adding the parameter to the request changes nothing)

Is there some way to specify the name in the authentication request? Working around with the “user-agent” http header seems very cumbersome, especially as there is no easy way to access the raw okhttp requests via the java library


Were you every able to resolve this issue or find a suitable workaround? I have been wanting to do this as well.


As you pointed out the use of the device name is associated with the legacy authentication endpoints that would allow to explicitly specify them. In the non-legacy endpoints that capability is not available, however, due to the fact that both legacy and non-legacy endpoints need to co-exist until the deprecated functionality is removed what you see currently is that there is some information automatically used in order to still display some information. Having said that I confirmed that if you’re using the non-legacy endpoints trying to leverage anything that’s associated with the device name functionality is not recommended.

In conclusion, device is a remnant of legacy authentication endpoints and should only be used if you still haven’t migrated from those legacy endpoints.