FBSDKAuthenticationToken.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright (c) Meta Platforms, Inc. and affiliates.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the license found in the
  6. * LICENSE file in the root directory of this source tree.
  7. */
  8. #import <Foundation/Foundation.h>
  9. #import <FBSDKCoreKit/FBSDKAuthenticationTokenProviding.h>
  10. @class FBSDKAuthenticationTokenClaims;
  11. @protocol FBSDKTokenCaching;
  12. NS_ASSUME_NONNULL_BEGIN
  13. /// Represent an AuthenticationToken used for a login attempt
  14. NS_SWIFT_NAME(AuthenticationToken)
  15. @interface FBSDKAuthenticationToken : NSObject <NSCopying, NSObject, NSSecureCoding, FBSDKAuthenticationTokenProviding>
  16. /**
  17. Internal init method exposed to facilitate transition to Swift.
  18. API Subject to change or removal without warning. Do not use.
  19. @warning INTERNAL - DO NOT USE
  20. */
  21. - (instancetype)initWithTokenString:(NSString *)tokenString
  22. nonce:(NSString *)nonce
  23. graphDomain:(NSString *)graphDomain;
  24. - (instancetype)init NS_UNAVAILABLE;
  25. + (instancetype)new NS_UNAVAILABLE;
  26. /**
  27. The "global" authentication token that represents the currently logged in user.
  28. The `currentAuthenticationToken` represents the authentication token of the
  29. current user and can be used by a client to verify an authentication attempt.
  30. */
  31. @property (class, nullable, nonatomic, copy) FBSDKAuthenticationToken *currentAuthenticationToken NS_SWIFT_NAME(current);
  32. /// The raw token string from the authentication response
  33. @property (nonatomic, readonly, copy) NSString *tokenString;
  34. /// The nonce from the decoded authentication response
  35. @property (nonatomic, readonly, copy) NSString *nonce;
  36. /// The graph domain where the user is authenticated.
  37. @property (nonatomic, readonly, copy) NSString *graphDomain;
  38. /// Returns the claims encoded in the AuthenticationToken
  39. - (nullable FBSDKAuthenticationTokenClaims *)claims;
  40. /**
  41. Internal Type exposed to facilitate transition to Swift.
  42. API Subject to change or removal without warning. Do not use.
  43. @warning INTERNAL - DO NOT USE
  44. */
  45. @property (class, nullable, nonatomic, copy) id<FBSDKTokenCaching> tokenCache;
  46. #pragma mark - Test methods
  47. #if DEBUG
  48. - (instancetype)initWithTokenString:(NSString *)tokenString
  49. nonce:(NSString *)nonce;
  50. + (void)resetCurrentAuthenticationTokenCache;
  51. #endif
  52. @end
  53. NS_ASSUME_NONNULL_END