Before using any methods from this SDK that call the backend, a proper language should be set. A properly translated content is served based on this configuration. The property that stores language settings does not persist. You need to set setAcceptLanguage
every time that the application boots.
Note: Content language capabilities are limited by the implementation of the server - it must support the provided language.
The WultraMobileToken
class offers a setAcceptLanguage
method to change the requested server language.
The default value is en
. With other languages, we use values compliant with standard RFC Accept-Language.
In the same manner, a user agent can be set via the setUserAgent
method.
The user agent is sent with every request to the server (as a standard User-Agent
HTTP header) and can be used for device/system detection.
User-agent can be overridden on the per-call basis in the requestProcessor
parameter for each API call of the SDK.
The default value will look like: MobileTokenJS/1.0.0 com.mycompany.myapp/1.5.2 (Apple; iOS/18.0; iPhone 14,3)
.
const mtoken = new WultraMobileToken(powerAuth, "https://my-instance.mycompany.com/enrollment-server") // create the WultraMobileToken instance
mtoken.setAcceptLanguage("de") // set "requested content" to german language (default is english - "en")
mtoken.setUserAgent("myuseragent") // custom user agent