Get a Token

You can obtain a short-lived access token to authenticate requests sent to the location services hosted on the HERE platform through:

Through HERE AA API

To get a token with the HERE AA API, you need to do the following:

  1. Create an OAuth 1.0 signature using your access key ID and access key secret from your credentials.properties file.
  2. Request a token using the HERE AA API.
  3. Create a new signature and request a new token after the old one expires (in 24 hours).

For more information on how to get and use access tokens, see the Authentication and Authorization Developer Guide

Through HERE AAA Java Client

You can use the HERE AAA Java Client library to manage token requests. You can find the HERE AAA Java Client library at HERE's GitHub account.

This library contains the HERE OAuth 2.0 Client that you can use for getting access tokens. You can run the Java code below to get your access token:

public String getToken() {
    ClientAuthorizationRequestProvider credentialsProvider = new OAuth1ClientCredentialsProvider(tokenEndpointUrl, accessKeyId, accessKeySecret);
    TokenEndpoint tokenEndpoint = HereAccount.getTokenEndpoint(
            ApacheHttpClientProvider.builder().build(),
            credentialsProvider);
    AccessTokenResponse fresh = tokenEndpoint.requestToken(new ClientCredentialsGrantRequest());
    return fresh.getAccessToken();
}

In the snippet above, tokenEndpointUrl, accessKeyId, and accessKeySecret are the properties from your credentials.properties file.

For more information on library usage, see the README.md file that is included in the library package.

Through HERE OLP CLI

The OLP CLI is a part of the HERE Data SDK. As opposed to the HERE platform portal's graphic interface, the OLP CLI offers a text-based interface allowing you to implement automated actions on platform services.

To get a token with the OLP CLI, use the olp api token getcommand. As a result, the token is displayed in the console as in the example below:

Token: eyJhbGciOiJSUzUxMiIsImN0eSI6IkpX...Mg5Nj1woORNHaigA
Token Expires at: 2019-08-01T14:03:48.100Z

results matching ""

    No results matching ""