Skip to content

Latest commit

 

History

History
37 lines (22 loc) · 1.61 KB

Language-UserAgent-Configuration.md

File metadata and controls

37 lines (22 loc) · 1.61 KB

Language and User-Agent Configuration

Content Language

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.

Usage

The WultraMobileToken class offers a setAcceptLanguage method to change the requested server language.

Format

The default value is en. With other languages, we use values compliant with standard RFC Accept-Language.

User-Agent

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.

Default User Agent

The default value will look like: MobileTokenJS/1.0.0 com.mycompany.myapp/1.5.2 (Apple; iOS/18.0; iPhone 14,3).

Example

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