コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
トークンとは
Fleet Engine では、信頼性の低い環境(スマートフォンやブラウザ)からの API メソッド呼び出しに JSON Web Token(JWT)を使用する必要があります。
JWT はサーバー上で生成され、署名、暗号化され、期限切れになるか無効になるまで、その後のサーバー インタラクションのためにクライアントに渡されます。
主な詳細
JSON Web Token の詳細については、Fleet Engine の基本の JSON Web Token をご覧ください。
クライアントはどのようにトークンを取得しますか?
ドライバーまたはユーザーが適切な認可認証情報を使用してアプリにログインすると、そのデバイスから発行される更新では、適切な認可トークンを使用する必要があります。このトークンは、アプリの権限を Fleet Engine に通知します。
デベロッパーは、クライアントの実装で次の機能を提供する必要があります。
- サーバーから JSON Web Token を取得します。
- トークンを期限切れになるまで再利用して、トークンの更新を最小限に抑えます。
- トークンの有効期限が切れたら更新します。
AuthTokenFactory
クラスは、位置情報の更新時に認可トークンを生成します。SDK は、Fleet Engine に送信する更新情報とともにトークンをパッケージ化する必要があります。SDK を初期化する前に、サーバーサイドの実装でトークンを発行できることを確認します。
Fleet Engine サービスで想定されるトークンの詳細については、Fleet Engine のJSON Web Token を発行するをご覧ください。
認可トークン取得ツールの例
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-31 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-08-31 UTC。"],[[["\u003cp\u003eFleet Engine requires JSON Web Tokens (JWTs) for API calls from low-trust environments like smartphones and browsers, which are signed by a service account on your server.\u003c/p\u003e\n"],["\u003cp\u003eYour backend should use standard Application Default Credentials to authenticate with Fleet Engine.\u003c/p\u003e\n"],["\u003cp\u003eClient applications need to fetch, reuse, and refresh JWTs from your server for authorization when interacting with Fleet Engine.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eAuthTokenFactory\u003c/code\u003e class helps generate these authorization tokens, which are then included with location updates sent to Fleet Engine.\u003c/p\u003e\n"]]],["JSON Web Tokens (JWTs) are required for API calls from low-trust environments like smartphones and browsers. Clients fetch JWTs from the server upon user login and reuse them until expiry, refreshing them as needed. The `AuthTokenFactory` class generates tokens packaged with update information for Fleet Engine. Your server must use Application Default Credentials and appropriate service accounts to sign and issue JWTs, communicating app permissions to Fleet Engine. Client implementations must fetch, reuse, and refresh these tokens.\n"],null,["What is a token?\n----------------\n\nFleet Engine requires the use of **JSON Web Tokens** (JWTs) for API method calls\nfrom **low-trust environments**: smartphones and browsers.\n\nA JWT originates on your server, is signed, encrypted, and passed to the client\nfor subsequent server interactions until it expires or is no longer valid.\n\n**Key details**\n\n- Use [Application Default Credentials](https://google.aip.dev/auth/4110) to authenticate and authorize against Fleet Engine.\n- Use an appropriate service account to sign JWTs. See [Fleet Engine serviceaccount](/maps/documentation/mobility/fleet-engine/essentials/set-up-fleet/service-accounts#fleet_engine_service_account_roles) roles in **Fleet Engine Basics**.\n\nFor more information about JSON Web Tokens, see [JSON Web Tokens](/maps/documentation/mobility/fleet-engine/essentials/set-up-fleet/jwt) in\n**Fleet Engine Essentials**.\n\nHow do clients get tokens?\n--------------------------\n\nOnce a driver or consumer logs in to your app using the appropriate\nauthorization credentials, any updates issued from that device must use\nappropriate authorization tokens, which communicates to Fleet Engine the\npermissions for the app.\n\nAs the developer, your client implementation should provide the ability to do\nthe following:\n\n- Fetch a JSON Web Token from your server.\n- Reuse the token until it expires to minimize token refreshes.\n- Refresh the token when it expires.\n\nThe `AuthTokenFactory` class generates authorization tokens at location update\ntime. The SDK must package the tokens with the update\ninformation to send to Fleet Engine. Make sure that your server-side\nimplementation can issue tokens before initializing the SDK.\n\nFor details of the tokens expected by the Fleet Engine service, see [Issue JSON\nWeb Tokens](/maps/documentation/mobility/fleet-engine/essentials/set-up-fleet/issue-jwt) for Fleet Engine.\n\nExample of an authorization token fetcher\n-----------------------------------------"]]