UserAuthConfig

Parameters for authentification.

Hierarchy

  • UserAuthConfig

Properties

Optional credentials

credentials?: AuthCredentials

Credentials for authorization.

Optional customUrl

customUrl?: string

The URL of your custom environment.

Optional env

env?: string

One of the following environments: here, here-dev, here-cn, and here-cn-dev.

Optional expiresIn

expiresIn?: number

The maximum validity of the token in seconds.

It must be equal or greater than zero. This value will be ignored if it is zero or greater than the maximum expiration defined by the application which is usually 24h.

Optional scope

scope?: string

Project scope.

If the project is specified, the resulting token is bound to it. If the desired resource is restricted to a specific project, to get a valid token, specify this project.

tokenRequester

tokenRequester: TokenRequesterFn

Gets the access token.

You can provide your own implementation or use one from @here/olp-sdk-authentication.

There are two functions that work for the browser and Node.js. For the browser, UserAuth uses requestToken() from requestToken.web.ts. For Node.js,UserAuth uses requestToken() from requestToken.ts.

When a function imports a function using import { requestToken } from "@here/olp-sdk-authentication"`, the code automatically applies to the corresponding function.

The following code is applicable only for Node.js.

example

import { UserAuth, requestToken } from "@here/olp-sdk-authentication";

 const userAuth = new UserAuth({
      credentials: {
          accessKeyId: "your-access-key",
          accessKeySecret: "your-access-key-secret"
      },
      tokenRequester: requestToken
  });