OAuthProvider
@available(iOS 13, tvOS 13, macOS 10.15, watchOS 7, *)
@objc(FIROAuthProvider)
open class OAuthProvider : NSObject, FederatedAuthProvider
Utility class for constructing OAuth Sign In credentials.
-
Undocumented
Declaration
Swift
@objc public static let id: String
-
Array used to configure the OAuth scopes.
Declaration
Swift
@objc open var scopes: [String]?
-
Dictionary used to configure the OAuth custom parameters.
Declaration
Swift
@objc open var customParameters: [String : String]?
-
The provider ID indicating the specific OAuth provider this OAuthProvider instance represents.
Declaration
Swift
@objc public let providerID: String
-
An instance of OAuthProvider corresponding to the given provider ID.
Declaration
Swift
@available(swift, deprecated: 0.1, message: "Use `provider(providerID: AuthProviderID﹚ -> OAuthProvider` instead.") @objc(providerWithProviderID:) open class func provider(providerID: String) -> OAuthProvider
Parameters
providerID
The provider ID of the IDP for which this auth provider instance will be configured.
Return Value
An instance of OAuthProvider corresponding to the specified provider ID.
-
An instance of OAuthProvider corresponding to the given provider ID.
Declaration
Swift
public class func provider(providerID: AuthProviderID) -> OAuthProvider
Parameters
providerID
The provider ID of the IDP for which this auth provider instance will be configured.
Return Value
An instance of OAuthProvider corresponding to the specified provider ID.
-
An instance of OAuthProvider corresponding to the given provider ID and auth instance.
Declaration
Swift
@available(swift, deprecated: 0.1, message: "Use `provider(providerID: AuthProviderID, auth: Auth﹚ -> OAuthProvider` instead.") @objc(providerWithProviderID:auth:) open class func provider(providerID: String, auth: Auth) -> OAuthProvider
Parameters
providerID
The provider ID of the IDP for which this auth provider instance will be configured.
auth
The auth instance to be associated with the OAuthProvider instance.
Return Value
An instance of OAuthProvider corresponding to the specified provider ID.
-
An instance of OAuthProvider corresponding to the given provider ID and auth instance.
Declaration
Swift
public class func provider(providerID: AuthProviderID, auth: Auth) -> OAuthProvider
Parameters
providerID
The provider ID of the IDP for which this auth provider instance will be configured.
auth
The auth instance to be associated with the OAuthProvider instance.
Return Value
An instance of OAuthProvider corresponding to the specified provider ID.
-
Initializes an
OAuthProvider
.Declaration
Swift
public convenience init(providerID: AuthProviderID, auth: Auth = Auth.auth())
Parameters
providerID
The provider ID of the IDP for which this auth provider instance will be configured.
auth
The auth instance to be associated with the OAuthProvider instance.
-
Creates an
AuthCredential
for the OAuth 2 provider identified by provider ID, ID token, and access token.Declaration
Swift
@available(swift, deprecated: 0.1, message: "Use `credential(providerID: AuthProviderID, idToken: String, accessToken: String? = nil﹚ -> OAuthCredential` instead.") @objc(credentialWithProviderID:IDToken:accessToken:) public static func credential(withProviderID providerID: String, idToken: String, accessToken: String?) -> OAuthCredential
Parameters
providerID
The provider ID associated with the Auth credential being created.
idToken
The IDToken associated with the Auth credential being created.
accessToken
The access token associated with the Auth credential be created, if available.
Return Value
An AuthCredential for the specified provider ID, ID token and access token.
-
Creates an
AuthCredential
for the OAuth 2 provider identified by provider ID, ID token, and access token.Declaration
Swift
public static func credential(providerID: AuthProviderID, idToken: String, accessToken: String? = nil) -> OAuthCredential
Parameters
providerID
The provider ID associated with the Auth credential being created.
idToken
The IDToken associated with the Auth credential being created.
accessToken
The access token associated with the Auth credential be created, if available.
Return Value
An AuthCredential for the specified provider ID, ID token and access token.
-
Creates an
AuthCredential
for the OAuth 2 provider identified by provider ID, ID token, and access token.Declaration
Swift
@available(swift, deprecated: 0.1, message: "Use `credential(providerID: AuthProviderID, accessToken: String﹚ -> OAuthCredential` instead.") @objc(credentialWithProviderID:accessToken:) public static func credential(withProviderID providerID: String, accessToken: String) -> OAuthCredential
Parameters
providerID
The provider ID associated with the Auth credential being created.
accessToken
The access token associated with the Auth credential be created, if available.
Return Value
An AuthCredential for the specified provider ID, ID token and access token.
-
Creates an
AuthCredential
for the OAuth 2 provider identified by provider ID using an ID token.Declaration
Swift
public static func credential(providerID: AuthProviderID, accessToken: String) -> OAuthCredential
Parameters
providerID
The provider ID associated with the Auth credential being created.
accessToken
The access token associated with the Auth credential be created
Return Value
An AuthCredential.
-
Creates an
AuthCredential
for that OAuth 2 provider identified by provider ID, ID token, raw nonce, and access token.Declaration
Swift
@available(swift, deprecated: 0.1, message: "Use `credential(providerID: AuthProviderID, idToken: String, rawNonce: String, accessToken: String? = nil﹚ -> OAuthCredential` instead.") @objc(credentialWithProviderID:IDToken:rawNonce:accessToken:) public static func credential(withProviderID providerID: String, idToken: String, rawNonce: String, accessToken: String) -> OAuthCredential
Parameters
providerID
The provider ID associated with the Auth credential being created.
idToken
The IDToken associated with the Auth credential being created.
rawNonce
The raw nonce associated with the Auth credential being created.
accessToken
The access token associated with the Auth credential be created.
Return Value
An AuthCredential for the specified provider ID, ID token and access token.
-
Creates an
AuthCredential
for that OAuth 2 provider identified by providerID using an ID token and raw nonce.Declaration
Swift
@available(swift, deprecated: 0.1, message: "Use `credential(providerID: AuthProviderID, idToken: String, rawNonce: String, accessToken: String? = nil﹚ -> OAuthCredential` instead.") @objc(credentialWithProviderID:IDToken:rawNonce:) public static func credential(withProviderID providerID: String, idToken: String, rawNonce: String) -> OAuthCredential
Parameters
providerID
The provider ID associated with the Auth credential being created.
idToken
The IDToken associated with the Auth credential being created.
rawNonce
The raw nonce associated with the Auth credential being created.
Return Value
An AuthCredential.
-
Creates an
AuthCredential
for that OAuth 2 provider identified by provider ID, ID token, raw nonce, and access token.Declaration
Swift
public static func credential(providerID: AuthProviderID, idToken: String, rawNonce: String, accessToken: String? = nil) -> OAuthCredential
Parameters
providerID
The provider ID associated with the Auth credential being created.
idToken
The IDToken associated with the Auth credential being created.
rawNonce
The raw nonce associated with the Auth credential being created.
accessToken
The access token associated with the Auth credential be created, if available.
Return Value
An AuthCredential for the specified provider ID, ID token and access token.
-
Used to obtain an auth credential via a mobile web flow.
This method is available on iOS only.
Declaration
Swift
open func getCredentialWith(_ uiDelegate: AuthUIDelegate?, completion: ((AuthCredential?, Error?) -> Void)? = nil)
Parameters
uiDelegate
An optional UI delegate used to present the mobile web flow.
completion
Optionally; a block which is invoked asynchronously on the main thread when the mobile web flow is completed.
-
Used to obtain an auth credential via a mobile web flow. This method is available on iOS only.
Declaration
Swift
@available(iOS 13, tvOS 13, macOS 10.15, watchOS 8, *) @objc(getCredentialWithUIDelegate:completion:) @MainActor open func credential(with uiDelegate: AuthUIDelegate?) async throws -> AuthCredential
Parameters
uiDelegate
An optional UI delegate used to present the mobile web flow.
completionHandler
Optionally; a block which is invoked asynchronously on the main thread when the mobile web flow is completed.
-
Creates an
AuthCredential
for the Sign in with Apple OAuth 2 provider identified by ID token, raw nonce, and full name.This method is specific to the Sign in with Apple OAuth 2 provider as this provider requires the full name to be passed explicitly.Declaration
Swift
@objc(appleCredentialWithIDToken:rawNonce:fullName:) public static func appleCredential(withIDToken idToken: String, rawNonce: String?, fullName: PersonNameComponents?) -> OAuthCredential
Parameters
idToken
The IDToken associated with the Sign in with Apple Auth credential being created.
rawNonce
The raw nonce associated with the Sign in with Apple Auth credential being created.
fullName
The full name associated with the Sign in with Apple Auth credential being created.
Return Value
An AuthCredential.