DouyinOpenSDKAuth.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. //
  2. // BDOpenPlatformAuth.h
  3. //
  4. // Created by ByteDance on 2019/7/8.
  5. // Copyright (c) 2018年 ByteDance Ltd. All rights reserved.
  6. //
  7. #import "DouyinOpenSDKObjects.h"
  8. #import "DouyinOpenSDKApplicationDelegate.h"
  9. NS_ASSUME_NONNULL_BEGIN
  10. @class DouyinOpenSDKAuthResponse;
  11. typedef void(^DouyinOpenSDKAuthCompleteBlock)(DouyinOpenSDKAuthResponse *resp);//!< Auth Result callback block
  12. #pragma mark - Auth Request
  13. @interface DouyinOpenSDKAuthRequest : DouyinOpenSDKBaseRequest
  14. /**
  15. The type of required permission applied by the third-party application to Open Platform is finally returned to the third-party application based on the actual authorization result after the App authorization is completed
  16. e.g. [NSOrderedSet orderedSetWithObjects:@"user_info", ..., nil]
  17. */
  18. @property (nonatomic, strong, nullable) NSOrderedSet<NSString *> *permissions;
  19. /**
  20. The additional permission type that the third-party application applies to Open Platform, the user can check whether to grant this part of the permission, and finally return to the third-party application according to the actual authorization result after the App authorization is completed;
  21. @key permission
  22. @key defaultChecked Initial check state, @"1" means check, @"0" means unchecked
  23. e.g. [NSOrderedSet orderedSetWithObjects:@{@"permission":@"user_info",@"defaultChecked":@"0"}, ..., nil]
  24. */
  25. @property (nonatomic, strong, nullable) NSOrderedSet<NSDictionary<NSString *,NSString *> *> *additionalPermissions;
  26. /**
  27. Used to identify the uniqueness of the request, and finally returned by App when jumping back to the third-party program
  28. */
  29. @property (nonatomic, copy, nullable) NSString *state;
  30. /**
  31. * @brief Send authorization request to Open Platform. If not install App will open authorized web page.
  32. *
  33. * @param viewController The view controller which show authorized web page
  34. * @param completed The async result call back. You can get reslut via resp.isSucceed.
  35. *
  36. * @return Authorization request is valid will return YES;
  37. */
  38. - (BOOL)sendAuthRequestViewController:(UIViewController *)viewController completeBlock:(DouyinOpenSDKAuthCompleteBlock)completed;
  39. @end
  40. #pragma mark - Auth Response
  41. @interface DouyinOpenSDKAuthResponse : DouyinOpenSDKBaseResponse
  42. /**
  43. You apply for certain permissions to Open Platform, and finally return to the third-party application based on the actual authorization result after the App authorization is completed.
  44. */
  45. @property (nonatomic, copy, readonly, nullable) NSString *code;
  46. /**
  47. State can be used to identify the uniqueness of the request, and finally returned by Open Platform when jumping back to a third-party program
  48. */
  49. @property (nonatomic, copy, readonly, nullable) NSString *state;
  50. /**
  51. The users agree to give your applications permission, if the authorization is successful, all necessary permissions and additional permissions checked by the user;
  52. */
  53. @property (nonatomic, strong, nullable) NSOrderedSet<NSString *> *grantedPermissions;
  54. @end
  55. NS_ASSUME_NONNULL_END