| | |
| | | #if 0 |
| | | #elif defined(__arm64__) && __arm64__ |
| | | // Generated by Apple Swift version 6.1.2 effective-5.10 (swiftlang-6.1.2.1.2 clang-1700.0.13.5) |
| | | // Generated by Apple Swift version 6.2.3 effective-5.10 (swiftlang-6.2.3.3.21 clang-1700.6.3.2) |
| | | #ifndef FBSDKLOGINKIT_SWIFT_H |
| | | #define FBSDKLOGINKIT_SWIFT_H |
| | | #pragma clang diagnostic push |
| | |
| | | |
| | | #if defined(__OBJC__) |
| | | |
| | | /// The app switch behavior preference to use for a login attempt. |
| | | /// App switch allows users to switch to the Facebook app for authentication if installed. |
| | | typedef SWIFT_ENUM_NAMED(NSUInteger, FBSDKAppSwitch, "AppSwitch", open) { |
| | | /// Do not use app switch. Use browser-based login (Safari View Controller). |
| | | FBSDKAppSwitchDisabled = 0, |
| | | /// Use app switch if the Facebook app is installed. |
| | | /// This allows users to switch to the Facebook app for authentication. This is the default. |
| | | FBSDKAppSwitchEnabled = 1, |
| | | }; |
| | | |
| | | @class NSString; |
| | | /// Represents a code verifier used in the PKCE (Proof Key for Code Exchange) |
| | | /// process. This is a cryptographically random string using the characters |
| | |
| | | @property (nonatomic) enum FBSDKTooltipColorStyle tooltipColorStyle; |
| | | /// Gets or sets the desired tracking preference to use for login attempts. Defaults to <code>.enabled</code> |
| | | @property (nonatomic) enum FBSDKLoginTracking loginTracking; |
| | | /// Gets or sets the app switch behavior. Defaults to <code>.enabled</code> |
| | | @property (nonatomic) enum FBSDKAppSwitch appSwitch; |
| | | /// Gets or sets an optional nonce to use for login attempts. A valid nonce must be a non-empty string without whitespace. |
| | | /// An invalid nonce will not be set. Instead, default unique nonces will be used for login attempts. |
| | | @property (nonatomic, copy) NSString * _Nullable nonce; |
| | |
| | | + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); |
| | | @end |
| | | |
| | | /// Errors emitted by <code>LoginManager.refreshLimitedLogin(...)</code>. |
| | | /// Each case names the <em>specific</em> condition the SDK detected, so a developer |
| | | /// can decide what to do without inspecting log output. The textual messages |
| | | /// returned by <code>errorDescription</code> describe the condition in actionable terms. |
| | | typedef SWIFT_ENUM_NAMED(NSInteger, FBSDKLimitedLoginRefreshError, "LimitedLoginRefreshError", open) { |
| | | /// <code>AuthenticationToken.current</code> is <code>nil</code>. There is no Limited Login session to |
| | | /// refresh — the user has either never logged in on this device or has logged out. |
| | | FBSDKLimitedLoginRefreshErrorNoCurrentToken = 0, |
| | | /// <code>Profile.current</code> exists but is not a Limited Login profile (<code>isLimited == false</code>). |
| | | /// <code>refreshLimitedLogin</code> only operates on Limited Login sessions; full Login sessions |
| | | /// use a different refresh mechanism. |
| | | FBSDKLimitedLoginRefreshErrorNotLimitedLogin = 1, |
| | | /// The Facebook session backing this token has expired (or never existed for this |
| | | /// browser session). The user must complete a full login flow to obtain a new token. |
| | | /// Maps to OIDC error code <code>login_required</code>. |
| | | FBSDKLimitedLoginRefreshErrorLoginRequired = 2, |
| | | /// The user has revoked one or more permissions, or new permissions are being |
| | | /// requested that were not previously granted. The user must complete a full login |
| | | /// flow to grant the missing consent. Maps to OIDC error code <code>consent_required</code>. |
| | | FBSDKLimitedLoginRefreshErrorConsentRequired = 3, |
| | | /// SECURITY: the refreshed token’s <code>sub</code> claim does not match the previously |
| | | /// authenticated user’s ID. The SDK refused to swap in the new token to prevent |
| | | /// session hijacking. Treat this as a state inconsistency: log the user out and |
| | | /// require a fresh login. |
| | | FBSDKLimitedLoginRefreshErrorUserMismatch = 4, |
| | | /// A transport-level network error occurred (DNS failure, connection reset, |
| | | /// TLS handshake failure, etc.). Safe to retry once connectivity is restored. |
| | | FBSDKLimitedLoginRefreshErrorNetworkError = 5, |
| | | /// The refresh request did not complete within the SDK’s timeout (30 seconds). |
| | | /// Safe to retry. Repeated timeouts may indicate a backend or network issue. |
| | | FBSDKLimitedLoginRefreshErrorTimeout = 6, |
| | | /// The client-side rate limiter is throttling refresh attempts. Inspect |
| | | /// <code>RefreshRateLimiter.shared.timeUntilNextAllowedAttempt()</code> to know how long |
| | | /// to wait before retrying. |
| | | FBSDKLimitedLoginRefreshErrorRateLimited = 7, |
| | | /// The server returned a 2xx response, but its body could not be parsed as the |
| | | /// expected refresh response (missing <code>id_token</code> field, malformed JSON, or claims |
| | | /// that fail OIDC structural validation such as missing <code>iss</code>/<code>aud</code>/<code>nonce</code>/<code>sub</code>). |
| | | /// Indicates a server-side issue or a protocol drift; not retryable client-side. |
| | | FBSDKLimitedLoginRefreshErrorInvalidResponse = 8, |
| | | /// The user cancelled an explicit (UI-presenting) login dialog. Only emitted by |
| | | /// <code>.explicitOnly</code> and the explicit fallback in <code>.automatic</code>. |
| | | FBSDKLimitedLoginRefreshErrorCancelled = 9, |
| | | /// The Limited Login Refresh feature is disabled by the |
| | | /// <code>FBSDKFeatureLimitedLoginRefresh</code> server-side feature flag. The SDK is |
| | | /// behaving as a kill switch — no refresh path will run while the flag is off. |
| | | /// Not retryable; recovery requires the flag to be flipped on server-side. |
| | | FBSDKLimitedLoginRefreshErrorFeatureDisabled = 10, |
| | | /// The current device is running an iOS version older than 13.0. The DPoP |
| | | /// (<code>.directOnly</code>) and silent (<code>.silentOnly</code>) refresh paths require iOS 13+ APIs. |
| | | FBSDKLimitedLoginRefreshErrorUnsupportedPlatform = 11, |
| | | /// The current <code>AuthenticationToken</code> has no <code>cnf.jkt</code> claim, so the <code>.directOnly</code> |
| | | /// refresh path cannot use it (DPoP needs the server to have bound a public-key |
| | | /// thumbprint to the token at issuance time). Typical causes: |
| | | /// (a) the token was issued before the SDK supported DPoP key binding; |
| | | /// (b) the device’s DPoP keypair was wiped (e.g. app reinstall) and no longer |
| | | /// matches the token’s <code>cnf.jkt</code>; |
| | | /// (c) the keychain was unavailable when the token was minted, so <code>dpop_jkt</code> |
| | | /// was silently omitted from the login request (see <code>.dpopKeyGenerationFailed</code>); |
| | | /// or |
| | | /// (d) the server-side feature flag was off when the token was issued. |
| | | /// Recovery: complete a fresh Limited Login (e.g. via <code>.explicitOnly</code> or |
| | | /// <code>.automatic</code>) to mint a newly-bound token. Under <code>.automatic</code>, this case |
| | | /// falls through to silent refresh, which sends <code>dpop_jkt</code> to mint a freshly |
| | | /// bound token; if silent then requires user interaction it falls back to |
| | | /// explicit. |
| | | FBSDKLimitedLoginRefreshErrorNotDPoPBound = 12, |
| | | /// The SDK could not generate or load the DPoP private key from the keychain. |
| | | /// The most common cause is the host app lacking a <code>keychain-access-groups</code> |
| | | /// entitlement (e.g. an unsigned simulator build, or a development build with |
| | | /// no <code>DEVELOPMENT_TEAM</code>/<code>CODE_SIGN_ENTITLEMENTS</code> configured). Other causes: |
| | | /// device locked before first unlock, Secure Enclave access denied, keychain |
| | | /// corruption. |
| | | /// When this happens at login time, <code>dpop_jkt</code> is silently omitted and the |
| | | /// resulting token has no <code>cnf.jkt</code> — subsequent <code>.directOnly</code> refreshes will |
| | | /// return <code>.notDPoPBound</code>. When it happens at refresh time, the SDK surfaces |
| | | /// this case directly. Inspect device console logs filtered to |
| | | /// <code>com.facebook.sdk</code> for the underlying <code>OSStatus</code> / <code>CFError</code> from |
| | | /// <code>SecKeyCreateRandomKey</code> / <code>SecAccessControlCreateWithFlags</code>. |
| | | FBSDKLimitedLoginRefreshErrorDpopKeyGenerationFailed = 13, |
| | | /// An error the SDK could not classify into one of the cases above. |
| | | FBSDKLimitedLoginRefreshErrorUnknown = 14, |
| | | }; |
| | | static NSString * _Nonnull const FBSDKLimitedLoginRefreshErrorDomain = @"FBSDKLoginKit.LimitedLoginRefreshError"; |
| | | |
| | | @class FBSDKLoginManagerLoginResult; |
| | | /// A delegate for <code>FBSDKLoginButton</code> |
| | | SWIFT_PROTOCOL_NAMED("LoginButtonDelegate") |
| | |
| | | @property (nonatomic, readonly, copy) NSString * _Nonnull nonce; |
| | | /// The tracking preference. Defaults to <code>.enabled</code>. |
| | | @property (nonatomic, readonly) enum FBSDKLoginTracking tracking; |
| | | /// The app switch behavior. Defaults to <code>.enabled</code>. |
| | | @property (nonatomic, readonly) enum FBSDKAppSwitch appSwitch; |
| | | /// The requested permissions for the login attempt. Defaults to an empty set. |
| | | @property (nonatomic, readonly, copy) NSSet<FBSDKPermission *> * _Nonnull requestedPermissions; |
| | | /// The Messenger Page Id associated with this login request. |
| | |
| | | /// @param nonce an optional nonce to use for the login attempt. A valid nonce must be a non-empty string without whitespace. |
| | | /// Creation of the configuration will fail if the nonce is invalid. |
| | | /// @param messengerPageId the associated page id to use for a login attempt. |
| | | /// @param appSwitch the app switch behavior to use for a login attempt. |
| | | - (nullable instancetype)initWithPermissions:(NSArray<NSString *> * _Nonnull)permissions tracking:(enum FBSDKLoginTracking)tracking nonce:(NSString * _Nonnull)nonce messengerPageId:(NSString * _Nullable)messengerPageId appSwitch:(enum FBSDKAppSwitch)appSwitch; |
| | | /// Attempts to initialize a new configuration with the expected parameters. |
| | | /// @param permissions the requested permissions for a login attempt. Permissions must be an array of strings that do not contain whitespace. |
| | | /// @param tracking the tracking preference to use for a login attempt. |
| | | /// @param nonce an optional nonce to use for the login attempt. A valid nonce must be a non-empty string without whitespace. |
| | | /// Creation of the configuration will fail if the nonce is invalid. |
| | | /// @param messengerPageId the associated page id to use for a login attempt. |
| | | /// @param authType auth_type param to use for login. |
| | | - (nullable instancetype)initWithPermissions:(NSArray<NSString *> * _Nonnull)permissions tracking:(enum FBSDKLoginTracking)tracking nonce:(NSString * _Nonnull)nonce messengerPageId:(NSString * _Nullable)messengerPageId authType:(FBSDKLoginAuthType _Nullable)authType; |
| | | /// Attempts to initialize a new configuration with the expected parameters. |
| | |
| | | /// @param tracking the tracking preference to use for a login attempt. |
| | | /// @param nonce an optional nonce to use for the login attempt. A valid nonce must be a non-empty string without whitespace. |
| | | /// Creation of the configuration will fail if the nonce is invalid. |
| | | /// @param messengerPageId the associated page id to use for a login attempt. |
| | | /// @param authType auth_type param to use for login. |
| | | /// @param appSwitch the app switch behavior to use for a login attempt. |
| | | - (nullable instancetype)initWithPermissions:(NSArray<NSString *> * _Nonnull)permissions tracking:(enum FBSDKLoginTracking)tracking nonce:(NSString * _Nonnull)nonce messengerPageId:(NSString * _Nullable)messengerPageId authType:(FBSDKLoginAuthType _Nullable)authType appSwitch:(enum FBSDKAppSwitch)appSwitch; |
| | | /// Attempts to initialize a new configuration with the expected parameters. |
| | | /// @param permissions the requested permissions for a login attempt. Permissions must be an array of strings that do not contain whitespace. |
| | | /// @param tracking the tracking preference to use for a login attempt. |
| | | /// @param nonce an optional nonce to use for the login attempt. A valid nonce must be a non-empty string without whitespace. |
| | | /// Creation of the configuration will fail if the nonce is invalid. |
| | | - (nullable instancetype)initWithPermissions:(NSArray<NSString *> * _Nonnull)permissions tracking:(enum FBSDKLoginTracking)tracking nonce:(NSString * _Nonnull)nonce; |
| | | /// Attempts to initialize a new configuration with the expected parameters. |
| | | /// @param permissions the requested permissions for a login attempt. Permissions must be an array of strings that do not contain whitespace. |
| | | /// @param tracking the tracking preference to use for a login attempt. |
| | | /// @param nonce an optional nonce to use for the login attempt. A valid nonce must be a non-empty string without whitespace. |
| | | /// @param appSwitch the app switch behavior to use for a login attempt. |
| | | /// Creation of the configuration will fail if the nonce is invalid. |
| | | - (nullable instancetype)initWithPermissions:(NSArray<NSString *> * _Nonnull)permissions tracking:(enum FBSDKLoginTracking)tracking nonce:(NSString * _Nonnull)nonce appSwitch:(enum FBSDKAppSwitch)appSwitch; |
| | | /// Attempts to initialize a new configuration with the expected parameters. |
| | | /// @param permissions the requested permissions for the login attempt. Permissions must be an array of strings that do not contain whitespace. |
| | | /// @param tracking the tracking preference to use for a login attempt. |
| | |
| | | /// @param permissions the requested permissions for the login attempt. Permissions must be an array of strings that do not contain whitespace. |
| | | /// @param tracking the tracking preference to use for a login attempt. |
| | | /// @param messengerPageId the associated page id to use for a login attempt. |
| | | /// @param appSwitch the app switch behavior to use for a login attempt. |
| | | - (nullable instancetype)initWithPermissions:(NSArray<NSString *> * _Nonnull)permissions tracking:(enum FBSDKLoginTracking)tracking messengerPageId:(NSString * _Nullable)messengerPageId appSwitch:(enum FBSDKAppSwitch)appSwitch; |
| | | /// Attempts to initialize a new configuration with the expected parameters. |
| | | /// @param permissions the requested permissions for the login attempt. Permissions must be an array of strings that do not contain whitespace. |
| | | /// @param tracking the tracking preference to use for a login attempt. |
| | | /// @param messengerPageId the associated page id to use for a login attempt. |
| | | /// @param authType auth_type param to use for login. |
| | | - (nullable instancetype)initWithPermissions:(NSArray<NSString *> * _Nonnull)permissions tracking:(enum FBSDKLoginTracking)tracking messengerPageId:(NSString * _Nullable)messengerPageId authType:(FBSDKLoginAuthType _Nullable)authType; |
| | | /// Attempts to initialize a new configuration with the expected parameters. |
| | | /// @param permissions the requested permissions for the login attempt. Permissions must be an array of strings that do not contain whitespace. |
| | | /// @param tracking the tracking preference to use for a login attempt. |
| | | /// @param messengerPageId the associated page id to use for a login attempt. |
| | | /// @param authType auth_type param to use for login. |
| | | /// @param appSwitch the app switch behavior to use for a login attempt. |
| | | - (nullable instancetype)initWithPermissions:(NSArray<NSString *> * _Nonnull)permissions tracking:(enum FBSDKLoginTracking)tracking messengerPageId:(NSString * _Nullable)messengerPageId authType:(FBSDKLoginAuthType _Nullable)authType appSwitch:(enum FBSDKAppSwitch)appSwitch; |
| | | /// Attempts to initialize a new configuration with the expected parameters. |
| | | /// @param permissions the requested permissions for a login attempt. Permissions must be an array of strings that do not contain whitespace. |
| | | /// @param tracking the tracking preference to use for a login attempt. |
| | |
| | | /// Creation of the configuration will fail if the nonce is invalid. |
| | | /// @param messengerPageId the associated page id to use for a login attempt. |
| | | /// @param authType auth_type param to use for login. |
| | | /// @param appSwitch the app switch behavior to use for a login attempt. Defaults to <code>.enabled</code>. |
| | | /// @param codeVerifier The code verifier used in the PKCE process. |
| | | - (nullable instancetype)initWithPermissions:(NSArray<NSString *> * _Nonnull)permissions tracking:(enum FBSDKLoginTracking)tracking nonce:(NSString * _Nonnull)nonce messengerPageId:(NSString * _Nullable)messengerPageId authType:(FBSDKLoginAuthType _Nullable)authType codeVerifier:(FBSDKCodeVerifier * _Nonnull)codeVerifier OBJC_DESIGNATED_INITIALIZER; |
| | | - (nullable instancetype)initWithPermissions:(NSArray<NSString *> * _Nonnull)permissions tracking:(enum FBSDKLoginTracking)tracking nonce:(NSString * _Nonnull)nonce messengerPageId:(NSString * _Nullable)messengerPageId authType:(FBSDKLoginAuthType _Nullable)authType appSwitch:(enum FBSDKAppSwitch)appSwitch codeVerifier:(FBSDKCodeVerifier * _Nonnull)codeVerifier OBJC_DESIGNATED_INITIALIZER; |
| | | /// Attempts to initialize a new configuration with the expected parameters. |
| | | /// @param permissions the requested permissions for the login attempt. Permissions must be an array of strings that do not contain whitespace. |
| | | /// @param tracking the tracking preference to use for a login attempt. |
| | | - (nullable instancetype)initWithPermissions:(NSArray<NSString *> * _Nonnull)permissions tracking:(enum FBSDKLoginTracking)tracking; |
| | | /// Attempts to initialize a new configuration with the expected parameters. |
| | | /// @param permissions the requested permissions for the login attempt. Permissions must be an array of strings that do not contain whitespace. |
| | | /// @param tracking the tracking preference to use for a login attempt. |
| | | /// @param appSwitch the app switch behavior to use for a login attempt. |
| | | - (nullable instancetype)initWithPermissions:(NSArray<NSString *> * _Nonnull)permissions tracking:(enum FBSDKLoginTracking)tracking appSwitch:(enum FBSDKAppSwitch)appSwitch; |
| | | /// Attempts to initialize a new configuration with the expected parameters. |
| | | /// @param tracking the login tracking preference to use for a login attempt. |
| | | - (nullable instancetype)initWithTracking:(enum FBSDKLoginTracking)tracking; |
| | | /// Attempts to initialize a new configuration with the expected parameters. |
| | | /// @param tracking the login tracking preference to use for a login attempt. |
| | | /// @param appSwitch the app switch behavior to use for a login attempt. |
| | | - (nullable instancetype)initWithTracking:(enum FBSDKLoginTracking)tracking appSwitch:(enum FBSDKAppSwitch)appSwitch; |
| | | - (nonnull instancetype)init SWIFT_UNAVAILABLE; |
| | | + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); |
| | | @end |
| | |
| | | - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; |
| | | @end |
| | | |
| | | enum FBSDKRefreshFallbackPolicy : NSInteger; |
| | | @class FBSDKProfile; |
| | | @interface FBSDKLoginManager (SWIFT_EXTENSION(FBSDKLoginKit)) |
| | | /// Refreshes a Limited Login session by obtaining an updated profile and authentication token. |
| | | /// This is the Objective-C compatible version of <code>refreshLimitedLogin(from:fallbackPolicy:completion:)</code>. |
| | | /// @param viewController The view controller from which to present login UI if needed. |
| | | /// If nil, the topmost view controller will be used. |
| | | /// @param fallbackPolicy The policy for handling silent refresh failures. |
| | | /// @param completion A closure called with the refreshed <code>Profile</code> on success, or an error on failure. |
| | | - (void)refreshLimitedLoginFromViewController:(UIViewController * _Nullable)viewController fallbackPolicy:(enum FBSDKRefreshFallbackPolicy)fallbackPolicy completion:(void (^ _Nonnull)(FBSDKProfile * _Nullable, NSError * _Nullable))completion; |
| | | @end |
| | | |
| | | @class UIApplication; |
| | | @interface FBSDKLoginManager (SWIFT_EXTENSION(FBSDKLoginKit)) <FBSDKURLOpening> |
| | | + (FBSDKLoginManager * _Nonnull)makeOpener SWIFT_WARN_UNUSED_RESULT; |
| | |
| | | FBSDKLoginTrackingLimited = 1, |
| | | }; |
| | | |
| | | @class FBSDKProfile; |
| | | /// Strategy for <code>LoginManager.refreshLimitedLogin(...)</code>. |
| | | /// The SDK provides three concrete refresh mechanisms (<code>.silentOnly</code>, <code>.directOnly</code>, |
| | | /// <code>.explicitOnly</code>) and one orchestrator (<code>.automatic</code>) that cascades through them. |
| | | typedef SWIFT_ENUM_NAMED(NSInteger, FBSDKRefreshFallbackPolicy, "RefreshFallbackPolicy", open) { |
| | | /// Cascade through the available refresh mechanisms, falling back to higher-friction |
| | | /// options when lower-friction ones cannot recover. Order: |
| | | /// <ol> |
| | | /// <li> |
| | | /// <code>.directOnly</code> (truly silent, DPoP-bound HTTPS POST). |
| | | /// </li> |
| | | /// <li> |
| | | /// On any failure other than <code>.featureDisabled</code> (including <code>.notDPoPBound</code>), |
| | | /// fall back to <code>.silentOnly</code> (<code>prompt=none</code> via ASWebAuthenticationSession). |
| | | /// Silent re-sends <code>dpop_jkt</code> to mint a freshly bound token, so it can recover |
| | | /// both a missing binding (<code>.notDPoPBound</code>) and transient direct-endpoint failures. |
| | | /// </li> |
| | | /// <li> |
| | | /// If <code>.silentOnly</code> returns <code>.loginRequired</code> or <code>.consentRequired</code>, fall back |
| | | /// to <code>.explicitOnly</code>. Otherwise propagate the result. |
| | | /// </li> |
| | | /// </ol> |
| | | /// <code>.featureDisabled</code> is <em>never</em> recovered — the kill switch is respected. |
| | | FBSDKRefreshFallbackPolicyAutomatic = 0, |
| | | /// Run only the <code>prompt=none</code> silent OIDC flow via <code>ASWebAuthenticationSession</code>. |
| | | /// Returns the result with no fallback. The user sees an Apple system consent |
| | | /// modal but no Facebook UI. |
| | | FBSDKRefreshFallbackPolicySilentOnly = 1, |
| | | /// Run only an explicit Limited Login flow (presents the standard Facebook login |
| | | /// dialog). Use when the caller wants to be sure the user re-authenticates. |
| | | FBSDKRefreshFallbackPolicyExplicitOnly = 2, |
| | | /// Run only the truly-silent direct refresh (DPoP-bound HTTPS POST to the refresh |
| | | /// endpoint). Returns <code>.notDPoPBound</code> when the current token has no <code>cnf.jkt</code> |
| | | /// claim, or <code>.loginRequired</code> when the server rejects the proof (e.g. the device |
| | | /// key no longer matches <code>cnf.jkt</code>). Use when no user-visible UI is acceptable. |
| | | FBSDKRefreshFallbackPolicyDirectOnly = 3, |
| | | }; |
| | | |
| | | /// Internal Type exposed to facilitate transition to Swift. |
| | | /// API Subject to change or removal without warning. Do not use. |
| | | /// <ul> |
| | |
| | | #endif |
| | | |
| | | #elif defined(__x86_64__) && __x86_64__ |
| | | // Generated by Apple Swift version 6.1.2 effective-5.10 (swiftlang-6.1.2.1.2 clang-1700.0.13.5) |
| | | // Generated by Apple Swift version 6.2.3 effective-5.10 (swiftlang-6.2.3.3.21 clang-1700.6.3.2) |
| | | #ifndef FBSDKLOGINKIT_SWIFT_H |
| | | #define FBSDKLOGINKIT_SWIFT_H |
| | | #pragma clang diagnostic push |
| | |
| | | |
| | | #if defined(__OBJC__) |
| | | |
| | | /// The app switch behavior preference to use for a login attempt. |
| | | /// App switch allows users to switch to the Facebook app for authentication if installed. |
| | | typedef SWIFT_ENUM_NAMED(NSUInteger, FBSDKAppSwitch, "AppSwitch", open) { |
| | | /// Do not use app switch. Use browser-based login (Safari View Controller). |
| | | FBSDKAppSwitchDisabled = 0, |
| | | /// Use app switch if the Facebook app is installed. |
| | | /// This allows users to switch to the Facebook app for authentication. This is the default. |
| | | FBSDKAppSwitchEnabled = 1, |
| | | }; |
| | | |
| | | @class NSString; |
| | | /// Represents a code verifier used in the PKCE (Proof Key for Code Exchange) |
| | | /// process. This is a cryptographically random string using the characters |
| | |
| | | @property (nonatomic) enum FBSDKTooltipColorStyle tooltipColorStyle; |
| | | /// Gets or sets the desired tracking preference to use for login attempts. Defaults to <code>.enabled</code> |
| | | @property (nonatomic) enum FBSDKLoginTracking loginTracking; |
| | | /// Gets or sets the app switch behavior. Defaults to <code>.enabled</code> |
| | | @property (nonatomic) enum FBSDKAppSwitch appSwitch; |
| | | /// Gets or sets an optional nonce to use for login attempts. A valid nonce must be a non-empty string without whitespace. |
| | | /// An invalid nonce will not be set. Instead, default unique nonces will be used for login attempts. |
| | | @property (nonatomic, copy) NSString * _Nullable nonce; |
| | |
| | | + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); |
| | | @end |
| | | |
| | | /// Errors emitted by <code>LoginManager.refreshLimitedLogin(...)</code>. |
| | | /// Each case names the <em>specific</em> condition the SDK detected, so a developer |
| | | /// can decide what to do without inspecting log output. The textual messages |
| | | /// returned by <code>errorDescription</code> describe the condition in actionable terms. |
| | | typedef SWIFT_ENUM_NAMED(NSInteger, FBSDKLimitedLoginRefreshError, "LimitedLoginRefreshError", open) { |
| | | /// <code>AuthenticationToken.current</code> is <code>nil</code>. There is no Limited Login session to |
| | | /// refresh — the user has either never logged in on this device or has logged out. |
| | | FBSDKLimitedLoginRefreshErrorNoCurrentToken = 0, |
| | | /// <code>Profile.current</code> exists but is not a Limited Login profile (<code>isLimited == false</code>). |
| | | /// <code>refreshLimitedLogin</code> only operates on Limited Login sessions; full Login sessions |
| | | /// use a different refresh mechanism. |
| | | FBSDKLimitedLoginRefreshErrorNotLimitedLogin = 1, |
| | | /// The Facebook session backing this token has expired (or never existed for this |
| | | /// browser session). The user must complete a full login flow to obtain a new token. |
| | | /// Maps to OIDC error code <code>login_required</code>. |
| | | FBSDKLimitedLoginRefreshErrorLoginRequired = 2, |
| | | /// The user has revoked one or more permissions, or new permissions are being |
| | | /// requested that were not previously granted. The user must complete a full login |
| | | /// flow to grant the missing consent. Maps to OIDC error code <code>consent_required</code>. |
| | | FBSDKLimitedLoginRefreshErrorConsentRequired = 3, |
| | | /// SECURITY: the refreshed token’s <code>sub</code> claim does not match the previously |
| | | /// authenticated user’s ID. The SDK refused to swap in the new token to prevent |
| | | /// session hijacking. Treat this as a state inconsistency: log the user out and |
| | | /// require a fresh login. |
| | | FBSDKLimitedLoginRefreshErrorUserMismatch = 4, |
| | | /// A transport-level network error occurred (DNS failure, connection reset, |
| | | /// TLS handshake failure, etc.). Safe to retry once connectivity is restored. |
| | | FBSDKLimitedLoginRefreshErrorNetworkError = 5, |
| | | /// The refresh request did not complete within the SDK’s timeout (30 seconds). |
| | | /// Safe to retry. Repeated timeouts may indicate a backend or network issue. |
| | | FBSDKLimitedLoginRefreshErrorTimeout = 6, |
| | | /// The client-side rate limiter is throttling refresh attempts. Inspect |
| | | /// <code>RefreshRateLimiter.shared.timeUntilNextAllowedAttempt()</code> to know how long |
| | | /// to wait before retrying. |
| | | FBSDKLimitedLoginRefreshErrorRateLimited = 7, |
| | | /// The server returned a 2xx response, but its body could not be parsed as the |
| | | /// expected refresh response (missing <code>id_token</code> field, malformed JSON, or claims |
| | | /// that fail OIDC structural validation such as missing <code>iss</code>/<code>aud</code>/<code>nonce</code>/<code>sub</code>). |
| | | /// Indicates a server-side issue or a protocol drift; not retryable client-side. |
| | | FBSDKLimitedLoginRefreshErrorInvalidResponse = 8, |
| | | /// The user cancelled an explicit (UI-presenting) login dialog. Only emitted by |
| | | /// <code>.explicitOnly</code> and the explicit fallback in <code>.automatic</code>. |
| | | FBSDKLimitedLoginRefreshErrorCancelled = 9, |
| | | /// The Limited Login Refresh feature is disabled by the |
| | | /// <code>FBSDKFeatureLimitedLoginRefresh</code> server-side feature flag. The SDK is |
| | | /// behaving as a kill switch — no refresh path will run while the flag is off. |
| | | /// Not retryable; recovery requires the flag to be flipped on server-side. |
| | | FBSDKLimitedLoginRefreshErrorFeatureDisabled = 10, |
| | | /// The current device is running an iOS version older than 13.0. The DPoP |
| | | /// (<code>.directOnly</code>) and silent (<code>.silentOnly</code>) refresh paths require iOS 13+ APIs. |
| | | FBSDKLimitedLoginRefreshErrorUnsupportedPlatform = 11, |
| | | /// The current <code>AuthenticationToken</code> has no <code>cnf.jkt</code> claim, so the <code>.directOnly</code> |
| | | /// refresh path cannot use it (DPoP needs the server to have bound a public-key |
| | | /// thumbprint to the token at issuance time). Typical causes: |
| | | /// (a) the token was issued before the SDK supported DPoP key binding; |
| | | /// (b) the device’s DPoP keypair was wiped (e.g. app reinstall) and no longer |
| | | /// matches the token’s <code>cnf.jkt</code>; |
| | | /// (c) the keychain was unavailable when the token was minted, so <code>dpop_jkt</code> |
| | | /// was silently omitted from the login request (see <code>.dpopKeyGenerationFailed</code>); |
| | | /// or |
| | | /// (d) the server-side feature flag was off when the token was issued. |
| | | /// Recovery: complete a fresh Limited Login (e.g. via <code>.explicitOnly</code> or |
| | | /// <code>.automatic</code>) to mint a newly-bound token. Under <code>.automatic</code>, this case |
| | | /// falls through to silent refresh, which sends <code>dpop_jkt</code> to mint a freshly |
| | | /// bound token; if silent then requires user interaction it falls back to |
| | | /// explicit. |
| | | FBSDKLimitedLoginRefreshErrorNotDPoPBound = 12, |
| | | /// The SDK could not generate or load the DPoP private key from the keychain. |
| | | /// The most common cause is the host app lacking a <code>keychain-access-groups</code> |
| | | /// entitlement (e.g. an unsigned simulator build, or a development build with |
| | | /// no <code>DEVELOPMENT_TEAM</code>/<code>CODE_SIGN_ENTITLEMENTS</code> configured). Other causes: |
| | | /// device locked before first unlock, Secure Enclave access denied, keychain |
| | | /// corruption. |
| | | /// When this happens at login time, <code>dpop_jkt</code> is silently omitted and the |
| | | /// resulting token has no <code>cnf.jkt</code> — subsequent <code>.directOnly</code> refreshes will |
| | | /// return <code>.notDPoPBound</code>. When it happens at refresh time, the SDK surfaces |
| | | /// this case directly. Inspect device console logs filtered to |
| | | /// <code>com.facebook.sdk</code> for the underlying <code>OSStatus</code> / <code>CFError</code> from |
| | | /// <code>SecKeyCreateRandomKey</code> / <code>SecAccessControlCreateWithFlags</code>. |
| | | FBSDKLimitedLoginRefreshErrorDpopKeyGenerationFailed = 13, |
| | | /// An error the SDK could not classify into one of the cases above. |
| | | FBSDKLimitedLoginRefreshErrorUnknown = 14, |
| | | }; |
| | | static NSString * _Nonnull const FBSDKLimitedLoginRefreshErrorDomain = @"FBSDKLoginKit.LimitedLoginRefreshError"; |
| | | |
| | | @class FBSDKLoginManagerLoginResult; |
| | | /// A delegate for <code>FBSDKLoginButton</code> |
| | | SWIFT_PROTOCOL_NAMED("LoginButtonDelegate") |
| | |
| | | @property (nonatomic, readonly, copy) NSString * _Nonnull nonce; |
| | | /// The tracking preference. Defaults to <code>.enabled</code>. |
| | | @property (nonatomic, readonly) enum FBSDKLoginTracking tracking; |
| | | /// The app switch behavior. Defaults to <code>.enabled</code>. |
| | | @property (nonatomic, readonly) enum FBSDKAppSwitch appSwitch; |
| | | /// The requested permissions for the login attempt. Defaults to an empty set. |
| | | @property (nonatomic, readonly, copy) NSSet<FBSDKPermission *> * _Nonnull requestedPermissions; |
| | | /// The Messenger Page Id associated with this login request. |
| | |
| | | /// @param nonce an optional nonce to use for the login attempt. A valid nonce must be a non-empty string without whitespace. |
| | | /// Creation of the configuration will fail if the nonce is invalid. |
| | | /// @param messengerPageId the associated page id to use for a login attempt. |
| | | /// @param appSwitch the app switch behavior to use for a login attempt. |
| | | - (nullable instancetype)initWithPermissions:(NSArray<NSString *> * _Nonnull)permissions tracking:(enum FBSDKLoginTracking)tracking nonce:(NSString * _Nonnull)nonce messengerPageId:(NSString * _Nullable)messengerPageId appSwitch:(enum FBSDKAppSwitch)appSwitch; |
| | | /// Attempts to initialize a new configuration with the expected parameters. |
| | | /// @param permissions the requested permissions for a login attempt. Permissions must be an array of strings that do not contain whitespace. |
| | | /// @param tracking the tracking preference to use for a login attempt. |
| | | /// @param nonce an optional nonce to use for the login attempt. A valid nonce must be a non-empty string without whitespace. |
| | | /// Creation of the configuration will fail if the nonce is invalid. |
| | | /// @param messengerPageId the associated page id to use for a login attempt. |
| | | /// @param authType auth_type param to use for login. |
| | | - (nullable instancetype)initWithPermissions:(NSArray<NSString *> * _Nonnull)permissions tracking:(enum FBSDKLoginTracking)tracking nonce:(NSString * _Nonnull)nonce messengerPageId:(NSString * _Nullable)messengerPageId authType:(FBSDKLoginAuthType _Nullable)authType; |
| | | /// Attempts to initialize a new configuration with the expected parameters. |
| | |
| | | /// @param tracking the tracking preference to use for a login attempt. |
| | | /// @param nonce an optional nonce to use for the login attempt. A valid nonce must be a non-empty string without whitespace. |
| | | /// Creation of the configuration will fail if the nonce is invalid. |
| | | /// @param messengerPageId the associated page id to use for a login attempt. |
| | | /// @param authType auth_type param to use for login. |
| | | /// @param appSwitch the app switch behavior to use for a login attempt. |
| | | - (nullable instancetype)initWithPermissions:(NSArray<NSString *> * _Nonnull)permissions tracking:(enum FBSDKLoginTracking)tracking nonce:(NSString * _Nonnull)nonce messengerPageId:(NSString * _Nullable)messengerPageId authType:(FBSDKLoginAuthType _Nullable)authType appSwitch:(enum FBSDKAppSwitch)appSwitch; |
| | | /// Attempts to initialize a new configuration with the expected parameters. |
| | | /// @param permissions the requested permissions for a login attempt. Permissions must be an array of strings that do not contain whitespace. |
| | | /// @param tracking the tracking preference to use for a login attempt. |
| | | /// @param nonce an optional nonce to use for the login attempt. A valid nonce must be a non-empty string without whitespace. |
| | | /// Creation of the configuration will fail if the nonce is invalid. |
| | | - (nullable instancetype)initWithPermissions:(NSArray<NSString *> * _Nonnull)permissions tracking:(enum FBSDKLoginTracking)tracking nonce:(NSString * _Nonnull)nonce; |
| | | /// Attempts to initialize a new configuration with the expected parameters. |
| | | /// @param permissions the requested permissions for a login attempt. Permissions must be an array of strings that do not contain whitespace. |
| | | /// @param tracking the tracking preference to use for a login attempt. |
| | | /// @param nonce an optional nonce to use for the login attempt. A valid nonce must be a non-empty string without whitespace. |
| | | /// @param appSwitch the app switch behavior to use for a login attempt. |
| | | /// Creation of the configuration will fail if the nonce is invalid. |
| | | - (nullable instancetype)initWithPermissions:(NSArray<NSString *> * _Nonnull)permissions tracking:(enum FBSDKLoginTracking)tracking nonce:(NSString * _Nonnull)nonce appSwitch:(enum FBSDKAppSwitch)appSwitch; |
| | | /// Attempts to initialize a new configuration with the expected parameters. |
| | | /// @param permissions the requested permissions for the login attempt. Permissions must be an array of strings that do not contain whitespace. |
| | | /// @param tracking the tracking preference to use for a login attempt. |
| | |
| | | /// @param permissions the requested permissions for the login attempt. Permissions must be an array of strings that do not contain whitespace. |
| | | /// @param tracking the tracking preference to use for a login attempt. |
| | | /// @param messengerPageId the associated page id to use for a login attempt. |
| | | /// @param appSwitch the app switch behavior to use for a login attempt. |
| | | - (nullable instancetype)initWithPermissions:(NSArray<NSString *> * _Nonnull)permissions tracking:(enum FBSDKLoginTracking)tracking messengerPageId:(NSString * _Nullable)messengerPageId appSwitch:(enum FBSDKAppSwitch)appSwitch; |
| | | /// Attempts to initialize a new configuration with the expected parameters. |
| | | /// @param permissions the requested permissions for the login attempt. Permissions must be an array of strings that do not contain whitespace. |
| | | /// @param tracking the tracking preference to use for a login attempt. |
| | | /// @param messengerPageId the associated page id to use for a login attempt. |
| | | /// @param authType auth_type param to use for login. |
| | | - (nullable instancetype)initWithPermissions:(NSArray<NSString *> * _Nonnull)permissions tracking:(enum FBSDKLoginTracking)tracking messengerPageId:(NSString * _Nullable)messengerPageId authType:(FBSDKLoginAuthType _Nullable)authType; |
| | | /// Attempts to initialize a new configuration with the expected parameters. |
| | | /// @param permissions the requested permissions for the login attempt. Permissions must be an array of strings that do not contain whitespace. |
| | | /// @param tracking the tracking preference to use for a login attempt. |
| | | /// @param messengerPageId the associated page id to use for a login attempt. |
| | | /// @param authType auth_type param to use for login. |
| | | /// @param appSwitch the app switch behavior to use for a login attempt. |
| | | - (nullable instancetype)initWithPermissions:(NSArray<NSString *> * _Nonnull)permissions tracking:(enum FBSDKLoginTracking)tracking messengerPageId:(NSString * _Nullable)messengerPageId authType:(FBSDKLoginAuthType _Nullable)authType appSwitch:(enum FBSDKAppSwitch)appSwitch; |
| | | /// Attempts to initialize a new configuration with the expected parameters. |
| | | /// @param permissions the requested permissions for a login attempt. Permissions must be an array of strings that do not contain whitespace. |
| | | /// @param tracking the tracking preference to use for a login attempt. |
| | |
| | | /// Creation of the configuration will fail if the nonce is invalid. |
| | | /// @param messengerPageId the associated page id to use for a login attempt. |
| | | /// @param authType auth_type param to use for login. |
| | | /// @param appSwitch the app switch behavior to use for a login attempt. Defaults to <code>.enabled</code>. |
| | | /// @param codeVerifier The code verifier used in the PKCE process. |
| | | - (nullable instancetype)initWithPermissions:(NSArray<NSString *> * _Nonnull)permissions tracking:(enum FBSDKLoginTracking)tracking nonce:(NSString * _Nonnull)nonce messengerPageId:(NSString * _Nullable)messengerPageId authType:(FBSDKLoginAuthType _Nullable)authType codeVerifier:(FBSDKCodeVerifier * _Nonnull)codeVerifier OBJC_DESIGNATED_INITIALIZER; |
| | | - (nullable instancetype)initWithPermissions:(NSArray<NSString *> * _Nonnull)permissions tracking:(enum FBSDKLoginTracking)tracking nonce:(NSString * _Nonnull)nonce messengerPageId:(NSString * _Nullable)messengerPageId authType:(FBSDKLoginAuthType _Nullable)authType appSwitch:(enum FBSDKAppSwitch)appSwitch codeVerifier:(FBSDKCodeVerifier * _Nonnull)codeVerifier OBJC_DESIGNATED_INITIALIZER; |
| | | /// Attempts to initialize a new configuration with the expected parameters. |
| | | /// @param permissions the requested permissions for the login attempt. Permissions must be an array of strings that do not contain whitespace. |
| | | /// @param tracking the tracking preference to use for a login attempt. |
| | | - (nullable instancetype)initWithPermissions:(NSArray<NSString *> * _Nonnull)permissions tracking:(enum FBSDKLoginTracking)tracking; |
| | | /// Attempts to initialize a new configuration with the expected parameters. |
| | | /// @param permissions the requested permissions for the login attempt. Permissions must be an array of strings that do not contain whitespace. |
| | | /// @param tracking the tracking preference to use for a login attempt. |
| | | /// @param appSwitch the app switch behavior to use for a login attempt. |
| | | - (nullable instancetype)initWithPermissions:(NSArray<NSString *> * _Nonnull)permissions tracking:(enum FBSDKLoginTracking)tracking appSwitch:(enum FBSDKAppSwitch)appSwitch; |
| | | /// Attempts to initialize a new configuration with the expected parameters. |
| | | /// @param tracking the login tracking preference to use for a login attempt. |
| | | - (nullable instancetype)initWithTracking:(enum FBSDKLoginTracking)tracking; |
| | | /// Attempts to initialize a new configuration with the expected parameters. |
| | | /// @param tracking the login tracking preference to use for a login attempt. |
| | | /// @param appSwitch the app switch behavior to use for a login attempt. |
| | | - (nullable instancetype)initWithTracking:(enum FBSDKLoginTracking)tracking appSwitch:(enum FBSDKAppSwitch)appSwitch; |
| | | - (nonnull instancetype)init SWIFT_UNAVAILABLE; |
| | | + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); |
| | | @end |
| | |
| | | - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; |
| | | @end |
| | | |
| | | enum FBSDKRefreshFallbackPolicy : NSInteger; |
| | | @class FBSDKProfile; |
| | | @interface FBSDKLoginManager (SWIFT_EXTENSION(FBSDKLoginKit)) |
| | | /// Refreshes a Limited Login session by obtaining an updated profile and authentication token. |
| | | /// This is the Objective-C compatible version of <code>refreshLimitedLogin(from:fallbackPolicy:completion:)</code>. |
| | | /// @param viewController The view controller from which to present login UI if needed. |
| | | /// If nil, the topmost view controller will be used. |
| | | /// @param fallbackPolicy The policy for handling silent refresh failures. |
| | | /// @param completion A closure called with the refreshed <code>Profile</code> on success, or an error on failure. |
| | | - (void)refreshLimitedLoginFromViewController:(UIViewController * _Nullable)viewController fallbackPolicy:(enum FBSDKRefreshFallbackPolicy)fallbackPolicy completion:(void (^ _Nonnull)(FBSDKProfile * _Nullable, NSError * _Nullable))completion; |
| | | @end |
| | | |
| | | @class UIApplication; |
| | | @interface FBSDKLoginManager (SWIFT_EXTENSION(FBSDKLoginKit)) <FBSDKURLOpening> |
| | | + (FBSDKLoginManager * _Nonnull)makeOpener SWIFT_WARN_UNUSED_RESULT; |
| | |
| | | FBSDKLoginTrackingLimited = 1, |
| | | }; |
| | | |
| | | @class FBSDKProfile; |
| | | /// Strategy for <code>LoginManager.refreshLimitedLogin(...)</code>. |
| | | /// The SDK provides three concrete refresh mechanisms (<code>.silentOnly</code>, <code>.directOnly</code>, |
| | | /// <code>.explicitOnly</code>) and one orchestrator (<code>.automatic</code>) that cascades through them. |
| | | typedef SWIFT_ENUM_NAMED(NSInteger, FBSDKRefreshFallbackPolicy, "RefreshFallbackPolicy", open) { |
| | | /// Cascade through the available refresh mechanisms, falling back to higher-friction |
| | | /// options when lower-friction ones cannot recover. Order: |
| | | /// <ol> |
| | | /// <li> |
| | | /// <code>.directOnly</code> (truly silent, DPoP-bound HTTPS POST). |
| | | /// </li> |
| | | /// <li> |
| | | /// On any failure other than <code>.featureDisabled</code> (including <code>.notDPoPBound</code>), |
| | | /// fall back to <code>.silentOnly</code> (<code>prompt=none</code> via ASWebAuthenticationSession). |
| | | /// Silent re-sends <code>dpop_jkt</code> to mint a freshly bound token, so it can recover |
| | | /// both a missing binding (<code>.notDPoPBound</code>) and transient direct-endpoint failures. |
| | | /// </li> |
| | | /// <li> |
| | | /// If <code>.silentOnly</code> returns <code>.loginRequired</code> or <code>.consentRequired</code>, fall back |
| | | /// to <code>.explicitOnly</code>. Otherwise propagate the result. |
| | | /// </li> |
| | | /// </ol> |
| | | /// <code>.featureDisabled</code> is <em>never</em> recovered — the kill switch is respected. |
| | | FBSDKRefreshFallbackPolicyAutomatic = 0, |
| | | /// Run only the <code>prompt=none</code> silent OIDC flow via <code>ASWebAuthenticationSession</code>. |
| | | /// Returns the result with no fallback. The user sees an Apple system consent |
| | | /// modal but no Facebook UI. |
| | | FBSDKRefreshFallbackPolicySilentOnly = 1, |
| | | /// Run only an explicit Limited Login flow (presents the standard Facebook login |
| | | /// dialog). Use when the caller wants to be sure the user re-authenticates. |
| | | FBSDKRefreshFallbackPolicyExplicitOnly = 2, |
| | | /// Run only the truly-silent direct refresh (DPoP-bound HTTPS POST to the refresh |
| | | /// endpoint). Returns <code>.notDPoPBound</code> when the current token has no <code>cnf.jkt</code> |
| | | /// claim, or <code>.loginRequired</code> when the server rejects the proof (e.g. the device |
| | | /// key no longer matches <code>cnf.jkt</code>). Use when no user-visible UI is acceptable. |
| | | FBSDKRefreshFallbackPolicyDirectOnly = 3, |
| | | }; |
| | | |
| | | /// Internal Type exposed to facilitate transition to Swift. |
| | | /// API Subject to change or removal without warning. Do not use. |
| | | /// <ul> |