VOAuthClient
@protocol VOAuthClient <NSObject>
VOAuthClient
is passed into the VOUserManager
to manage registration and automatic token refreshing.
A class must implement VOAuthClient
and be passed into the VOUserManager
login call.
-
This method will be called after login if a user is required for registration.
Declaration
Objective-C
- (void)userForRegistrationWithCredential:(VOCredential *)credential onSuccess:(void (^)(VOCredential *, VOSimpleUser *))onSuccess onError:(void (^)(NSError *))onError;
Swift
func userForRegistration(with credential: VOCredential!, onSuccess: ((VOCredential?, VOSimpleUser?) -> Void)!, onError: ((Error?) -> Void)!)
Parameters
credential
- The
VOCredential
that was used to login.onSuccess
- Success block that must be called with a simple user and credential for registration. The same credential that is passed in can be sent back.
onError
- Error block that must be called if registration is not possible at this time.
-
This method will be called when a users
VOCredential
s has expired.Note
this method will be called on a background thread.Declaration
Objective-C
- (void)refreshTokenOnSuccess:(void (^)(VOCredential *))onSuccess onError:(void (^)(NSError *))onError;
Swift
optional func refreshToken(onSuccess: ((VOCredential?) -> Void)!, onError: ((Error?) -> Void)!)
Parameters
onSuccess
- success block that should be called if the
VOCredential
was refreshed successfully.onError
- error block that should be called if the
VOCredential
was not refreshed successfully. -
This method will be called if the
VOUserManager
logs out the user due to invalid authentication.Declaration
Objective-C
- (void)logout;
Swift
optional func logout()