@@ -142,18 +142,32 @@ BUILT_ASSUME_NONNULL_BEGIN
142142
143143
144144/* *
145- @abstract The authtoken after logging in
145+ @abstract The accessToken after logging in
146146
147- //Obj-C
148- NSString *authToken = userObject.authtoken;
149-
150- //Swift
151- var authToken:String = userObject.authtoken
147+ //Obj-C
148+ NSString *accessToken = userObject.accessToken;
149+
150+ //Swift
151+ var accessToken:String = userObject.accessToken
152+
153+
154+ @discussion The accessToken after logging in
155+ */
156+ @property (nullable , nonatomic , copy , readonly ) NSString *accessToken;
157+
158+ /* *
159+ @abstract The refreshToken after logging in
160+
161+ //Obj-C
162+ NSString *refreshToken = userObject.refreshToken;
163+
164+ //Swift
165+ var refreshToken:String = userObject.refreshToken
152166
153167
154- @discussion The authtoken after logging in
168+ @discussion The refreshToken after logging in
155169 */
156- @property (nullable , nonatomic , copy , readonly ) NSString *authtoken ;
170+ @property (nullable , nonatomic , copy , readonly ) NSString *refreshToken ;
157171
158172
159173/* *
@@ -729,6 +743,84 @@ Updates the existing user asynchronously
729743
730744- (void )saveAsDraftEventually : (BuiltRequestCompletionHandler)completionBlock BUILTIO_DEPRECATED(" Not for BuiltUser" );
731745
746+ // MARK: - SSO Login
747+ /* *---------------------------------------------------------------------------------------
748+ * @name SSO Login
749+ * ---------------------------------------------------------------------------------------
750+ */
751+
752+ #if TARGET_OS_IOS
753+ /* *
754+ Asynchronously login using SSO token
755+
756+ //Obj-C
757+ BuiltApplication *builtApplication = [Built applicationWithAPIKey:@"blt5d4sample2633b"];
758+ BuiltUser *ssoUser = [builtApplication user];
759+ [ssoUser loginWithSSO:^(BuiltResponseType responseType, NSError *error) {
760+
761+ }];
762+
763+ //Swift
764+ var builtApplication:BuiltApplication = Built.applicationWithAPIKey("blt5d4sample2633b")
765+ var ssoUser:BuiltUser = builtApplication.user()
766+ ssoUser.loginWithSSO { (responseType, error!) -> Void in
767+
768+ }
769+
770+ @param completionBlock Completion block with params (BuiltResponseType responseType, id responseJSON, NSError *error)
771+ */
772+ - (void )loginWithSSO:(BuiltRequestCompletionHandler)completionBlock;
773+ #endif
774+
775+
776+ // MARK: - Refresh access token
777+ /* *---------------------------------------------------------------------------------------
778+ * @name Refresh access token
779+ * ---------------------------------------------------------------------------------------
780+ */
781+
782+ /* *
783+ Asynchronously refresh the user access_token from server using refresh_token
784+
785+ //Obj-C
786+ BuiltUser *userObject = [builtApplication user];
787+ [userObject refreshAccessToken:@"blt_sample_refresh_token" completion:^(BuiltResponseType responseType, NSError *error) {
788+
789+ }];
790+
791+ //Swift
792+ var userObject:BuiltUser = builtApplication.user()
793+ refreshAccessToken("blt_sample_refresh_token") { (responseType, error!) -> Void in
794+
795+ }
796+
797+ @param refreshToken refresh_token
798+ @param completionBlock Completion block with params (BuiltResponseType responseType, id responseJSON, NSError *error)
799+
800+ @note If persistRefreshToken property is true in BuiltConfig, you have to use this method for refreshing the user access_token.
801+ */
802+ - (void )refreshAccessToken : (NSString *)refreshToken completion : (BuiltRequestCompletionHandler)completionBlock ;
803+
804+ /* *
805+ Asynchronously refresh the user access_token from server using refresh_token
806+
807+ //Obj-C
808+ BuiltUser *userObject = [builtApplication user];
809+ [userObject refreshAccessToken:^(BuiltResponseType responseType, NSError *error) {
810+
811+ }];
812+
813+ //Swift
814+ var userObject:BuiltUser = builtApplication.user()
815+ refreshAccessToken { (responseType, error!) -> Void in
816+
817+ }
818+
819+ @param completionBlock Completion block with params (BuiltResponseType responseType, id responseJSON, NSError *error)
820+
821+ @note If persistRefreshToken property is false in BuiltConfig, you have to use this method for refreshing the user access_token.
822+ */
823+ - (void )refreshAccessToken : (BuiltRequestCompletionHandler)completionBlock ;
732824
733825@end
734826
0 commit comments