AI-generated Key Takeaways
-
The
GMTCAuthorization
protocol provides authorization tokens for gRPC calls, granting access to Fleet Engine service accounts. -
Implementations of this protocol must ensure a continuous supply of valid authorization tokens with a minimum 5-minute lifetime to accommodate request completion.
-
Token renewals should be automatic to extend the token's validity and minimize the need for frequent refreshes, optimizing token reusability.
-
The
fetchTokenWithContext:completion:
method, used by the SDK to get a JWT, may be called from any queue, making thread-safety a mandatory requirement for protocol implementations. -
The completion handler provided in
fetchTokenWithContext:completion:
must be invoked asynchronously and can be executed from any queue.
GMTCAuthorization
@protocol GMTCAuthorization <NSObject>
Protocol used to provide authorization tokens for gRPC calls. These tokens give access to the Fleet Engine service accounts.
The implementation should ensure that a valid authorization token is always available. The authorization token should have a minimum lifetime of 5 minutes to allow for requests to complete. Therefore, the authorization token must automatically renew expiring tokens and minimize the number of token refreshes by re-using a token until its lifetime nears its end.
Implementations of this protocol must be thread-safe.
-
Called by the SDK to fetch a JWT. The implementation must assume that this method may be invoked from arbitrary queues.
Declaration
Swift
func fetchToken(with authorizationContext: GMTCAuthorizationContext?) async throws -> String
Objective-C
- (void)fetchTokenWithContext: (nullable GMTCAuthorizationContext *)authorizationContext completion: (nonnull GMTCAuthTokenFetchCompletionHandler)completion;
Parameters
authorizationContext
The context of the target authorization token.
completion
Must be called asynchronously, but can be called from any queue.