AuthTokenFactory
Stay organized with collections
Save and categorize content based on your preferences.
Provides authorization tokens for accessing the provider's service account on Fleet Engine
via gRPC. The factory ensures that there is always a valid access token available. The access
token should have a remaining minimum lifetime of at least 5 minutes to allow for requests to
complete. That means that the access token factory must automatically renew expiring tokens.
It should also minimize the number of token refreshes by re-using a token until its lifetime
nears its end.
Public Methods
Returns the value for an "Authorization" HTTP request header for a gRPC call to the
Fleet Engine.
Parameters
context |
Additional information used during auth token minting. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-27 UTC.
[null,null,["Last updated 2025-08-27 UTC."],[[["\u003cp\u003e\u003ccode\u003eAuthTokenFactory\u003c/code\u003e provides authorization tokens for accessing Fleet Engine via gRPC, ensuring a valid token is always available.\u003c/p\u003e\n"],["\u003cp\u003eThe factory automatically renews expiring tokens and minimizes refreshes by re-using them until near expiration.\u003c/p\u003e\n"],["\u003cp\u003eTokens should have a minimum remaining lifetime of 5 minutes to allow requests to complete.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egetToken\u003c/code\u003e method returns a value for the "Authorization" header in gRPC calls to Fleet Engine.\u003c/p\u003e\n"],["\u003cp\u003eAn \u003ccode\u003eAuthTokenContext\u003c/code\u003e object can be passed to \u003ccode\u003egetToken\u003c/code\u003e to provide additional information during token generation.\u003c/p\u003e\n"]]],[],null,["# AuthTokenFactory\n\npublic interface **AuthTokenFactory** \nProvides authorization tokens for accessing the provider's service account on Fleet Engine\nvia gRPC. The factory ensures that there is always a valid access token available. The access\ntoken should have a remaining minimum lifetime of at least 5 minutes to allow for requests to\ncomplete. That means that the access token factory must automatically renew expiring tokens.\nIt should also minimize the number of token refreshes by re-using a token until its lifetime\nnears its end. \n\n### Public Method Summary\n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [String](//developer.android.com/reference/java/lang/String.html) | [getToken](/maps/documentation/mobility/journey-sharing/on-demand/reference/consumer_2/android/reference/com/google/android/libraries/mapsplatform/transportation/consumer/auth/AuthTokenFactory#getToken(com.google.android.libraries.mapsplatform.transportation.consumer.auth.AuthTokenContext))([AuthTokenContext](/maps/documentation/mobility/journey-sharing/on-demand/reference/consumer_2/android/reference/com/google/android/libraries/mapsplatform/transportation/consumer/auth/AuthTokenContext) context) Returns the value for an \"Authorization\" HTTP request header for a gRPC call to the Fleet Engine. |\n\nPublic Methods\n--------------\n\n#### public abstract [String](//developer.android.com/reference/java/lang/String.html) **getToken** ([AuthTokenContext](/maps/documentation/mobility/journey-sharing/on-demand/reference/consumer_2/android/reference/com/google/android/libraries/mapsplatform/transportation/consumer/auth/AuthTokenContext) context)\n\nReturns the value for an \"Authorization\" HTTP request header for a gRPC call to the\nFleet Engine. \n\n##### Parameters\n\n| context | Additional information used during auth token minting. |\n|---------|--------------------------------------------------------|"]]