SCCameraKitAccessTokenProvider
Objective-C
@protocol SCCameraKitAccessTokenProvider <NSObject>
Swift
protocol AccessTokenProvider : NSObjectProtocol
Describes an interface to provide an access token (ie. from LoginKit) required by some features like connected lenses, push to device, etc.
-
If the user is already authenticated, fetch a valid/non-expired access token to be used by some features like connected lenses, push to device, etc. Returns an access token task if the fetch token task is cancellable or nil if the task is not cancellable.
Note
It is up to the provider to ensure that the access token will be active for the lifetime of the feature using the token.Declaration
Objective-C
- (nullable id<SCCameraKitAccessTokenProviderTask>) fetchAccessTokenIfAuthenticatedWithCompletion: (nonnull void (^)(NSString *_Nullable, NSError *_Nullable))completion;
Swift
func fetchAccessTokenIfAuthenticated(completion: @escaping (String?, Error?) -> Void) -> AccessTokenProviderTask?
Parameters
completion
Callback on completion with access token on success or error on failure.
-
Fetch a valid/non-expired access token to be used by some features like connected lenses, push to device, etc. May take the user through an authentication flow if the user is not already authenticated. Returns an access token task if the fetch token task is cancellable or nil if the task is not cancellable.
Note
It is up to the provider to ensure that the access token will be active for the lifetime of the feature using the token.Declaration
Objective-C
- (nullable id<SCCameraKitAccessTokenProviderTask>) fetchAccessTokenWithCompletion: (nonnull void (^)(NSString *_Nullable, NSError *_Nullable))completion;
Swift
func fetchAccessToken(completion: @escaping (String?, Error?) -> Void) -> AccessTokenProviderTask?
Parameters
completion
Callback on completion with access token on success or error on failure.