> ## Documentation Index
> Fetch the complete documentation index at: https://docs-dev-actions-triggers-prototype.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Lock.Android:JSON Webトークンのリフレッシュ

> このページでは、リフレッシュトークンを使用してユーザーのログイン状態を維持する方法について説明します。

認証時に`offline_access`スコープが含まれている場合、認証情報と共にリフレッシュトークンが返されます。この値は、新しいアクセストークンを要求する際に使用でき、ユーザーに再び認証情報を入力させることを避けられます。

トークンは、認証が成功した後、安全なストレージに保存しなければなりません。リフレッシュトークンが **決して期限切れにならない** ように注意してください。新しいトークンを要求するには`Auth0.Android`の`AuthenticationAPIClient`を使用します。

## リフレッシュトークンの使用

```kotlin lines theme={null}
val refreshToken: String = // Retrieve Refresh Token from secure storage
val account = Auth0(this)

val client = AuthenticationAPIClient(account)
client.renewAuth(refreshToken)
  .start(object: Callback<Credentials, AuthenticationException> {
  override fun onFailure(exception: AuthenticationException) {
       // Error
   }

   override fun onSuccess(credentials: Credentials) {
       // Use the credentials
   }
})
```
