> For the complete documentation index, see [llms.txt](https://docs.payments.thalescloud.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.payments.thalescloud.io/nfc-wallet-sdk-android/ja/implement-nfc-wallet/manage-digital-cards/get-an-access-token.md).

# アクセストークンを取得する

## 概要

中に **トークン化**、NFC Wallet SDK は、〜との安全なチャネルを確立します **NFC Wallet バックエンド** 〜するとき [プロビジョニングをトリガーする](/nfc-wallet-sdk-android/ja/implement-nfc-wallet/tokenize-a-card/trigger-provisioning.md).

SDK はこの安全なチャネルを使用して、〜を発行します **アクセストークン** 対象：

* デジタルカード **LCM**
* 取引通知

アクセストークンには有効期限があります。必要に応じて更新してください。

## SDK 連携

使用する `ProvisioningBusinessService` および **デジタルカード ID** アクセストークンを取得するために。

実装する `AccessTokenListener` でトークンを受け取るために `onSuccess(...)`.

{% hint style="warning" %}
アクセストークンは機密データとして扱ってください。

ログに出力したり、ディスクに永続化したりしないでください。
{% endhint %}

{% code title="GetAccessToken.java" %}

```java
public void getAccessToken(final String digitalCardId) {
    final ProvisioningBusinessService provisioningService =
            ProvisioningServiceManager.getProvisioningBusinessService();

    provisioningService.getAccessToken(
            digitalCardId,
            GetAccessTokenMode.REFRESH,
            new AccessTokenListener() {
                @Override
                public void onSuccess(final String digitalCardId, final String accessToken) {
                    // トークンは正常に取得されました。
                    // これを使用して LCM サービスを呼び出し、取引通知を取得します。
                }

                @Override
                public void onError(final String digitalCardId, final ProvisioningServiceError error) {
                    // エラーを処理します（たとえば、データ接続がない場合）。
                }
            }
    );
}
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.payments.thalescloud.io/nfc-wallet-sdk-android/ja/implement-nfc-wallet/manage-digital-cards/get-an-access-token.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
