Get your credentials

Get your credentials

All users of the HERE platform must obtain authentication and authorization
credentials.

For the available authentication options, see the
Identity and Access Management Developer Guide.

Note

Downloading the Data Client Base Library
To download the Data Client Base Library, you need repository credentials.
To obtain your credentials, go to
https://platform.here.com/profile/repository
and click Create credentials to download the settings.xml file.

Credential options

The snippets below demonstrate different ways of supplying your platform
credentials to the Data Client Base Library.

When you initialize a new service client without supplying any credentials as
arguments, the Data Client Base Library attempts to find your platform
credentials using the default credential provider chain: a platform credentials
file in the JVM classpath, the default location platform credentials download
location ($HOME/.here/credentials.properties) and the Java system properties
in that order.

Note

Billing tags
The snippets below also demonstrate the use of the HERE platform billing tags,
which you can use in requests to the HERE platform in order to later associate
your requests with the invoicing for those requests.

Set your credentials via the application's configuration file

This is the recommended approach.

Based on the values in the platform credentials, include the following
parameters in your application.conf file:

com.here.platform.data.client.request-signer {
  billing-tag = "example_billing_tag"
  credentials {
    here-account {
      here-token-endpoint-url = "https://account.api.here.com/oauth2/token"
      here-client-id = "example-client-id"
      here-access-key-id = "example-access-key-id"
      here-access-key-secret = "example-access-key-secret"
    }
  }
}
com.here.platform.data.client.request-signer {
  billing-tag = "example_billing_tag"
  credentials {
    here-token = "example-token"
  }
}

Set your credentials in the credentials file

The Data Client Base Library can read HERE access key and access secret data
from the credentials.properties file.

  • The client looks for a credentials.properties file in the Java Virtual
    Machine (JVM) classpath.

  • A fallback location to find platform credentials is in
    $HOME/.here/credentials.properties

  • Alternatively, you can specify an alternate credentials file location in the
    application.conf file.

  com.here.platform.data.client.request-signer {
    billing-tag = "example_billing_tag"
    credentials {
     file-path = "/path/credentials.properties"
    }
  }

Example of credentials properties file:

  here.user.id = example-here-user-id
  here.client.id=example-client-id
  here.access.key.id=example-access-key-id
  here.access.key.secret=example-access-key-secret
  here.token.endpoint.url=https://account.api.here.com/oauth2/token

Set your credentials via Java system properties

To set your credentials via Java System Properties, define the following:

-Dcom.here.platform.data.client.request-signer.credentials.here-account.here-token-endpoint-url="https://account.api.here.com/oauth2/token"
-Dcom.here.platform.data.client.request-signer.credentials.here-account.here-client-id="example-client-id"
-Dcom.here.platform.data.client.request-signer.credentials.here-account.here-access-key-id="example-access-key-id"
-Dcom.here.platform.data.client.request-signer.credentials.here-account.here-access-key-secret="example-access-key-secret"
-Dcom.here.platform.data.client.request-signer.credentials.here-token="example-token"

Set your credentials programmatically

To set your HERE account programmatically, include the following in your
project:

val someCredentials = Some(
  HereAccountCredentials(
    "some-client-id",
    "some-access-key-id",
    "some-access-key-secret",
    "some-token-endpoint-url",
    Some("some-token-scope <optional>")
  ))
val client = BaseClient(ConfigFactory.load(), credentials = someCredentials)
HereAccountCredentials someCredentials =
    new HereAccountCredentials.Builder()
        .withHereClientId("some-client-id")
        .withHereAccessKeyId("some-access-key-id")
        .withHereAccessKeySecret("some-access-key-secret")
        .withHereTokenEndpointUrl("some-token-endpoint-url")
        .withHereTokenScope("some-token-scope <optional>")
        .build();
BaseClient client = new BaseClientJava.Builder().withCredentials(someCredentials).build();

To set your HERE token programmatically, include the following in your project:

val someCredentials = Some(HereTokenCredentials("some-access-token"))
val client = BaseClient(ConfigFactory.load(), credentials = someCredentials)
HereTokenCredentials someCredentials =
    new HereTokenCredentials.Builder().withHereToken("some-access-token").build();
BaseClient client = new BaseClientJava.Builder().withCredentials(someCredentials).build();

Did this page help you?