Repository: firebase/firebase-ios-sdk (language: cpp)

Issue:
Convert FIRAuthProvider.m constants into enum
<!-- DO NOT DELETE
validate_template=true
template_path=.github/ISSUE_TEMPLATE/feature_request.md
-->
### Feature proposal

* Firebase Component: Auth

#### Description
Currently the file [FIRAuthProvider.m](https://github.com/firebase/firebase-ios-sdk/blob/master/FirebaseAuth/Sources/AuthProvider/FIRAuthProvider.m) contains auth provider ids, as `constants`.
My request is to replace these with an `enum`, so it'll be easier to make `switch-case` block when needed.

It just makes a lot more sense than creating my own enum by manually copying the values from the file or make some non-convenience long and unnecessary `else-if`.
P.S. You may add as well case for `AppleProviderID` as `"apple.com"`.

#### Usage case example
Generate the correct credential for `reauthenticate(with: credential)` based on `Auth.auth().currentUser?.providerData.first?.providerID`.


Discussion / hints:
Implemented in `auth-swift` branch.

Fix patch:
diff --git a/FirebaseAuth/CHANGELOG.md b/FirebaseAuth/CHANGELOG.md
index 4d9ab5bd0bb..d321d14aebf 100644
--- a/FirebaseAuth/CHANGELOG.md
+++ b/FirebaseAuth/CHANGELOG.md
@@ -1,6 +1,9 @@
 # 11.0.0
 - [fixed] Fixed auth domain matching code to prioritize matching `firebaseapp.com` over `web.app`
   even if the server returns the `web.app` domain listed first. (#7992)
+- [added] Introduced the Swift enum `AuthProviderID` for the Auth Provider IDs. (#9236)
+- [deprecated] Swift APIs using `String`-typed `productID`s have been deprecated in favor
+  of newly added API that leverages the `AuthProviderID` enum.
 
 # 10.21.0
 - [fixed] Fixed multifactor resolver to use the correct Auth instance instead of
diff --git a/FirebaseAuth/Sources/Swift/AuthProvider/AuthProviderStrings.swift b/FirebaseAuth/Sources/Swift/AuthProvider/AuthProviderStrings.swift
index 978497fc8f4..2ac74c8be6e 100644
--- a/FirebaseAuth/Sources/Swift/AuthProvider/AuthProviderStrings.swift
+++ b/FirebaseAuth/Sources/Swift/AuthProvider/AuthProviderStrings.swift
@@ -14,8 +14,8 @@
 
 import Foundation
 
-/// Enumeration of the available Auth Providers.
-public enum AuthProviderString: String {
+/// Enumeration of the available Auth Provider IDs.
+public enum AuthProviderID: String {
   case apple = "apple.com"
   case email = "password"
   case facebook = "facebook.com"
diff --git a/FirebaseAuth/Sources/Swift/AuthProvider/OAuthProvider.swift b/FirebaseAuth/Sources/Swift/AuthProvider/OAuthProvider.swift
index 1566513855f..7190435316c 100644
--- a/FirebaseAuth/Sources/Swift/AuthProvider/OAuthProvider.swift
+++ b/FirebaseAuth/Sources/Swift/AuthProvider/OAuthProvider.swift
@@ -29,22 +29,56 @@ import Foundation
   /// The provider ID indicating the specific OAuth provider this OAuthProvider instance represents.
   @objc public let providerID: String
 
-  /// - Parameter providerID: The provider ID of the IDP for which this auth provider instance will
-  /// be configured.
+  /// An instance of OAuthProvider corresponding to the given provider ID.
+  /// - Parameters:
+  ///   - providerID: The provider ID of the IDP for which this auth provider instance will be
+  /// configured.
   /// - Returns: An instance of OAuthProvider corresponding to the specified provider ID.
+  @available(
+    swift,
+    deprecated: 0.01,
+    message: "Use `provider(providerID: AuthProviderID) -> OAuthProvider` instead."
+  )
   @objc(providerWithProviderID:) open class func provider(providerID: String) -> OAuthProvider {
     return OAuthProvider(providerID: providerID, auth: Auth.auth())
   }
 
-  /// - Parameter providerID: The provider ID of the IDP for which this auth provider instance will
-  /// be configured.
-  /// - Parameter auth: The auth instance to be associated with the OAuthProvider instance.
+  /// An instance of OAuthProvider corresponding to the given provider ID.
+  /// - Parameters:
+  ///   - providerID: The provider ID of the IDP for which this auth provider instance will be
+  /// configured.
+  /// - Returns: An instance of OAuthProvider corresponding to the specified provider ID.
+  public class func provider(providerID: AuthProviderID) -> OAuthProvider {
+    return OAuthProvider(providerID: providerID.rawValue, auth: Auth.auth())
+  }
+
+  /// An instance of OAuthProvider corresponding to the given provider ID and auth instance.
+  /// - 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.
   /// - Returns: An instance of OAuthProvider corresponding to the specified provider ID.
+  @available(
+    swift,
+    deprecated: 0.01,
+    message: "Use `provider(providerID: AuthProviderID, auth: Auth) -> OAuthProvider` instead."
+  )
   @objc(providerWithProviderID:auth:) open class func provider(providerID: String,
                                                                auth: Auth) -> OAuthProvider {
     return OAuthProvider(providerID: providerID, auth: auth)
   }
 
+  /// An instance of OAuthProvider corresponding to the given provider ID and auth instance.
+  /// - 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.
+  /// - Returns: An instance of OAuthProvider corresponding to the specified provider ID.
+  public class func provider(providerID: AuthProviderID, auth: Auth) -> OAuthProvider {
+    return OAuthProvider(providerID: providerID.rawValue, auth: auth)
+  }
+
+  /// Initializes an `OAuthProvider`.
   /// - Parameter providerID: The provider ID of the IDP for which this auth provider instance will
   /// be configured.
   /// - Parameter auth: The auth instance to be associated with the OAuthProvider instance.
@@ -55,7 +89,7 @@ import Foundation
         fatalError("Sign in with Facebook is not supported via generic IDP; the Facebook TOS " +
           "dictate that you must use the Facebook iOS SDK for Facebook login.")
       }
-      if providerID == AuthProviderString.apple.rawValue {
+      if providerID == AuthProviderID.apple.rawValue {
         fatalError("Sign in with Apple is not supported via generic IDP; You must use the Apple SDK" +
           " for Sign in with Apple.")
       }
@@ -84,6 +118,15 @@ import Foundation
     }
   }
 
+  /// Initializes an `OAuthProvider`.
+  /// - Parameter providerID: The provider ID of the IDP for which this auth provider instance will
+  /// be configured.
+  /// - Parameter auth: The auth instance to be associated with the OAuthProvider instance.
+  /// - Returns: An instance of OAuthProvider corresponding to the specified provider ID.
+  public convenience init(providerID: AuthProviderID, auth: Auth = Auth.auth()) {
+    self.init(providerID: providerID.rawValue, auth: auth)
+  }
+
   /// Creates an `AuthCredential` for the OAuth 2 provider identified by provider ID, ID
   /// token, and access token.
   /// - Parameter providerID: The provider ID associated with the Auth credential being created.
@@ -91,6 +134,11 @@ import Foundation
   /// - Parameter accessToken: The access token associated with the Auth credential be created, if
   /// available.
   /// - Returns: An AuthCredential for the specified provider ID, ID token and access token.
+  @available(
+    swift,
+    deprecated: 0.01,
+    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,
@@ -98,15 +146,48 @@ import Foundation
     return OAuthCredential(withProviderID: providerID, idToken: idToken, accessToken: accessToken)
   }
 
+  /// Creates an `AuthCredential` for the OAuth 2 provider identified by provider ID, ID
+  /// token, and access token.
+  /// - Parameter providerID: The provider ID associated with the Auth credential being created.
+  /// - Parameter idToken: The IDToken associated with the Auth credential being created.
+  /// - Parameter accessToken: The access token associated with the Auth credential be created, if
+  /// available.
+  /// - Returns: An AuthCredential for the specified provider ID, ID token and access token.
+  public static func credential(providerID: AuthProviderID,
+                                idToken: String,
+                                accessToken: String? = nil) -> OAuthCredential {
+    return OAuthCredential(
+      withProviderID: providerID.rawValue,
+      idToken: idToken,
+      accessToken: accessToken
+    )
+  }
+
+  /// Creates an `AuthCredential` for the OAuth 2 provider identified by provider ID, ID
+  /// token, and access token.
+  /// - Parameter providerID: The provider ID associated with the Auth credential being created.
+  /// - Parameter accessToken: The access token associated with the Auth credential be created, if
+  /// available.
+  /// - Returns: An AuthCredential for the specified provider ID, ID token and access token.
+  @available(
+    swift,
+    deprecated: 0.01,
+    message: "Use `credential(providerID: AuthProviderID, accessToken: String) -> OAuthCredential` instead."
+  )
+  @objc(credentialWithProviderID:accessToken:)
+  public static func credential(withProviderID providerID: String,
+                                accessToken: String) -> OAuthCredential {
+    return OAuthCredential(withProviderID: providerID, accessToken: accessToken)
+  }
+
   /// Creates an `AuthCredential` for the OAuth 2 provider identified by provider ID using
   /// an ID token.
   /// - Parameter providerID: The provider ID associated with the Auth credential being created.
   /// - Parameter accessToken: The access token associated with the Auth credential be created
   /// - Returns: An AuthCredential.
-  @objc(credentialWithProviderID:accessToken:)
-  public static func credential(withProviderID providerID: String,
+  public static func credential(providerID: AuthProviderID,
                                 accessToken: String) -> OAuthCredential {
-    return OAuthCredential(withProviderID: providerID, accessToken: accessToken)
+    return OAuthCredential(withProviderID: providerID.rawValue, accessToken: accessToken)
   }
 
   /// Creates an `AuthCredential` for that OAuth 2 provider identified by provider ID, ID
@@ -114,9 +195,13 @@ import Foundation
   /// - Parameter providerID: The provider ID associated with the Auth credential being created.
   /// - Parameter idToken: The IDToken associated with the Auth credential being created.
   /// - Parameter rawNonce: The raw nonce associated with the Auth credential being created.
-  /// - Parameter accessToken: The access token associated with the Auth credential be created, if
-  /// available.
+  /// - Parameter accessToken: The access token associated with the Auth credential be created.
   /// - Returns: An AuthCredential for the specified provider ID, ID token and access token.
+  @available(
+    swift,
+    deprecated: 0.01,
+    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,
@@ -135,12 +220,36 @@ import Foundation
   /// - Parameter idToken: The IDToken associated with the Auth credential being created.
   /// - Parameter rawNonce: The raw nonce associated with the Auth credential being created.
   /// - Returns: An AuthCredential.
+  @available(
+    swift,
+    deprecated: 0.01,
+    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 {
     return OAuthCredential(withProviderID: providerID, idToken: idToken, rawNonce: rawNonce)
   }
 
+  /// Creates an `AuthCredential` for that OAuth 2 provider identified by provider ID, ID
+  /// token, raw nonce, and access token.
+  /// - Parameter providerID: The provider ID associated with the Auth credential being created.
+  /// - Parameter idToken: The IDToken associated with the Auth credential being created.
+  /// - Parameter rawNonce: The raw nonce associated with the Auth credential being created.
+  /// - Parameter accessToken: The access token associated with the Auth credential be created, if
+  /// available.
+  /// - Returns: An AuthCredential for the specified provider ID, ID token and access token.
+  public static func credential(providerID: AuthProviderID, idToken: String,
+                                rawNonce: String,
+                                accessToken: String? = nil) -> OAuthCredential {
+    return OAuthCredential(
+      withProviderID: providerID.rawValue,
+      idToken: idToken,
+      rawNonce: rawNonce,
+      accessToken: accessToken
+    )
+  }
+
   #if os(iOS)
     /// Used to obtain an auth credential via a mobile web flow.
     ///
@@ -247,7 +356,7 @@ import Foundation
   public static func appleCredential(withIDToken idToken: String,
                                      rawNonce: String?,
                                      fullName: PersonNameComponents?) -> OAuthCredential {
-    return OAuthCredential(withProviderID: AuthProviderString.apple.rawValue,
+    return OAuthCredential(withProviderID: AuthProviderID.apple.rawValue,
                            idToken: idToken,
                            rawNonce: rawNonce,
                            fullName: fullName)
diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/RevokeTokenRequest.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/RevokeTokenRequest.swift
index c69ab2b60b0..632060237dd 100644
--- a/FirebaseAuth/Sources/Swift/Backend/RPC/RevokeTokenRequest.swift
+++ b/FirebaseAuth/Sources/Swift/Backend/RPC/RevokeTokenRequest.swift
@@ -62,7 +62,7 @@ class RevokeTokenRequest: IdentityToolkitRequest, AuthRPCRequest {
        requestConfiguration: AuthRequestConfiguration) {
     // Apple and authorization code are the only provider and token type we support for now.
     // Generalize this initializer to accept other providers and token types once supported.
-    providerID = AuthProviderString.apple.rawValue
+    providerID = AuthProviderID.apple.rawValue
     tokenType = .authorizationCode
     self.token = token
     self.idToken = idToken
diff --git a/FirebaseAuth/Tests/Unit/AuthProviderIDTests.swift b/FirebaseAuth/Tests/Unit/AuthProviderIDTests.swift
index 375d9bcf19a..ff2c3b8ecfe 100644
--- a/FirebaseAuth/Tests/Unit/AuthProviderIDTests.swift
+++ b/FirebaseAuth/Tests/Unit/AuthProviderIDTests.swift
@@ -21,14 +21,14 @@ final class AuthProviderIDTests: XCTestCase {
   // Verify that AuthProviderID enum values match the class values published for Objective C
   // compatibility.
   func testAuthProviderIDEnumRawValue() {
-    XCTAssertEqual(AuthProviderString.apple.rawValue, "apple.com")
-    XCTAssertEqual(AuthProviderString.email.rawValue, EmailAuthProvider.id)
-    XCTAssertEqual(AuthProviderString.facebook.rawValue, FacebookAuthProvider.id)
+    XCTAssertEqual(AuthProviderID.apple.rawValue, "apple.com")
+    XCTAssertEqual(AuthProviderID.email.rawValue, EmailAuthProvider.id)
+    XCTAssertEqual(AuthProviderID.facebook.rawValue, FacebookAuthProvider.id)
     #if !os(watchOS)
-      XCTAssertEqual(AuthProviderString.gameCenter.rawValue, GameCenterAuthProvider.id)
+      XCTAssertEqual(AuthProviderID.gameCenter.rawValue, GameCenterAuthProvider.id)
     #endif
-    XCTAssertEqual(AuthProviderString.gitHub.rawValue, GitHubAuthProvider.id)
-    XCTAssertEqual(AuthProviderString.google.rawValue, GoogleAuthProvider.id)
-    XCTAssertEqual(AuthProviderString.phone.rawValue, PhoneAuthProvider.id)
+    XCTAssertEqual(AuthProviderID.gitHub.rawValue, GitHubAuthProvider.id)
+    XCTAssertEqual(AuthProviderID.google.rawValue, GoogleAuthProvider.id)
+    XCTAssertEqual(AuthProviderID.phone.rawValue, PhoneAuthProvider.id)
   }
 }
diff --git a/FirebaseAuth/Tests/Unit/AuthTests.swift b/FirebaseAuth/Tests/Unit/AuthTests.swift
index c4353f1014c..b3464f67829 100644
--- a/FirebaseAuth/Tests/Unit/AuthTests.swift
+++ b/FirebaseAuth/Tests/Unit/AuthTests.swift
@@ -1132,7 +1132,7 @@ class AuthTests: RPCBaseTests {
       // 2. Validate the created Request instance.
       let request = try XCTUnwrap(self.rpcIssuer.request as? VerifyAssertionRequest)
       XCTAssertEqual(request.apiKey, AuthTests.kFakeAPIKey)
-      XCTAssertEqual(request.providerID, AuthProviderString.apple.rawValue)
+      XCTAssertEqual(request.providerID, AuthProviderID.apple.rawValue)
       XCTAssertEqual(request.providerIDToken, kAppleIDToken)
       XCTAssertEqual(request.fullName, fullName)
       XCTAssertTrue(request.returnSecureToken)
@@ -1141,7 +1141,7 @@ class AuthTests: RPCBaseTests {
       try self.rpcIssuer.respond(withJSON: ["idToken": RPCBaseTests.kFakeAccessToken,
                                             "refreshToken": self.kRefreshToken,
                                             "federatedId": self.kGoogleID,
-                                            "providerId": AuthProviderString.apple.rawValue,
+                                            "providerId": AuthProviderID.apple.rawValue,
                                             "localId": self.kLocalID,
                                             "displayName": self.kGoogleDisplayName,
                                             "rawUserInfo": self.kGoogleProfile,
@@ -1164,7 +1164,7 @@ class AuthTests: RPCBaseTests {
         }
         XCTAssertEqual(profile, self.kGoogleProfile)
         XCTAssertEqual(additionalUserInfo.username, self.kGoogleDisplayName)
-        XCTAssertEqual(additionalUserInfo.providerID, AuthProviderString.apple.rawValue)
+        XCTAssertEqual(additionalUserInfo.providerID, AuthProviderID.apple.rawValue)
       } catch {
         XCTFail("\(error)")
       }
@@ -1910,7 +1910,7 @@ class AuthTests: RPCBaseTests {
     rpcIssuer.respondBlock = {
       let request = try XCTUnwrap(self.rpcIssuer.request as? RevokeTokenRequest)
       XCTAssertEqual(request.apiKey, AuthTests.kFakeAPIKey)
-      XCTAssertEqual(request.providerID, AuthProviderString.apple.rawValue)
+      XCTAssertEqual(request.providerID, AuthProviderID.apple.rawValue)
       XCTAssertEqual(request.token, code)
       XCTAssertEqual(request.tokenType, .authorizationCode)
 
@@ -1936,7 +1936,7 @@ class AuthTests: RPCBaseTests {
     issuer?.respondBlock = {
       let request = try XCTUnwrap(issuer?.request as? RevokeTokenRequest)
       XCTAssertEqual(request.apiKey, AuthTests.kFakeAPIKey)
-      XCTAssertEqual(request.providerID, AuthProviderString.apple.rawValue)
+      XCTAssertEqual(request.providerID, AuthProviderID.apple.rawValue)
       XCTAssertEqual(request.token, code)
       XCTAssertEqual(request.tokenType, .authorizationCode)
 
diff --git a/FirebaseAuth/Tests/Unit/OAuthProviderTests.swift b/FirebaseAuth/Tests/Unit/OAuthProviderTests.swift
index 120b6dd0a9b..6f1ed895b0a 100644
--- a/FirebaseAuth/Tests/Unit/OAuthProviderTests.swift
+++ b/FirebaseAuth/Tests/Unit/OAuthProviderTests.swift
@@ -55,10 +55,10 @@ import FirebaseCore
      */
     func testObtainingOAuthCredentialNoIDToken() throws {
       initApp(#function)
-      let credential = OAuthProvider.credential(withProviderID: kFakeProviderID,
+      let credential = OAuthProvider.credential(providerID: .apple,
                                                 accessToken: kFakeAccessToken)
       XCTAssertEqual(credential.accessToken, kFakeAccessToken)
-      XCTAssertEqual(credential.provider, kFakeProviderID)
+      XCTAssertEqual(credential.provider, AuthProviderID.apple.rawValue)
       XCTAssertNil(credential.idToken)
     }
 
@@ -85,11 +85,11 @@ import FirebaseCore
      */
     func testObtainingOAuthCredentialWithIDToken() throws {
       initApp(#function)
-      let credential = OAuthProvider.credential(withProviderID: kFakeProviderID,
+      let credential = OAuthProvider.credential(providerID: .email,
                                                 idToken: kFakeIDToken,
                                                 accessToken: kFakeAccessToken)
       XCTAssertEqual(credential.accessToken, kFakeAccessToken)
-      XCTAssertEqual(credential.provider, kFakeProviderID)
+      XCTAssertEqual(credential.provider, AuthProviderID.email.rawValue)
       XCTAssertEqual(credential.idToken, kFakeIDToken)
     }
 
diff --git a/FirebaseAuth/Tests/Unit/ObjCAPITests.m b/FirebaseAuth/Tests/Unit/ObjCAPITests.m
index 884f10928e2..096305f545c 100644
--- a/FirebaseAuth/Tests/Unit/ObjCAPITests.m
+++ b/FirebaseAuth/Tests/Unit/ObjCAPITests.m
@@ -417,6 +417,9 @@ - (void)oauthCredential:(FIROAuthCredential *)credential {
 
 #if TARGET_OS_IOS
 - (void)FIROAuthProvider_h:(FIROAuthProvider *)provider {
+  FIROAuthProvider *p = [FIROAuthProvider providerWithProviderID:@""];
+  p = [FIROAuthProvider providerWithProviderID:@"" auth:[FIRAuth auth]];
+
   FIROAuthCredential *c = [FIROAuthProvider credentialWithProviderID:@"id" accessToken:@"token"];
   c = [FIROAuthProvider credentialWithProviderID:@"id"
                                          IDToken:@"idToken"
diff --git a/FirebaseAuth/Tests/Unit/RevokeTokenTests.swift b/FirebaseAuth/Tests/Unit/RevokeTokenTests.swift
index 14cc9685f08..945e1e1ee1b 100644
--- a/FirebaseAuth/Tests/Unit/RevokeTokenTests.swift
+++ b/FirebaseAuth/Tests/Unit/RevokeTokenTests.swift
@@ -42,7 +42,7 @@ class RevokeTokenTests: RPCBaseTests {
       value: kFakeToken
     )
     let requestDictionary = try XCTUnwrap(rpcIssuer.decodedRequest as? [String: AnyHashable])
-    XCTAssertEqual(requestDictionary[kFakeProviderIDKey], AuthProviderString.apple.rawValue)
+    XCTAssertEqual(requestDictionary[kFakeProviderIDKey], AuthProviderID.apple.rawValue)
     XCTAssertEqual(requestDictionary[kFakeTokenTypeKey], "3")
   }
 
diff --git a/FirebaseAuth/Tests/Unit/SwiftAPI.swift b/FirebaseAuth/Tests/Unit/SwiftAPI.swift
index d620e9c0ea7..c5063ae1151 100644
--- a/FirebaseAuth/Tests/Unit/SwiftAPI.swift
+++ b/FirebaseAuth/Tests/Unit/SwiftAPI.swift
@@ -469,17 +469,37 @@ class AuthAPI_hOnlyTests: XCTestCase {
   }
 
   func FIROAuthProvider_h() {
-    let provider = OAuthProvider(providerID: "id", auth: FirebaseAuth.Auth.auth())
-    _ = provider.providerID
+    let _: (String, Auth) -> OAuthProvider = OAuthProvider.init(providerID:auth:)
+    let _: (AuthProviderID, Auth) -> OAuthProvider = OAuthProvider.init(providerID:auth:)
+    let _: (String) -> OAuthProvider = OAuthProvider.provider(providerID:)
+    let _: (String, Auth) -> OAuthProvider = OAuthProvider.provider(providerID:auth:)
+    let _: (AuthProviderID) -> OAuthProvider = OAuthProvider.provider(providerID:)
+    let _: (AuthProviderID, Auth) -> OAuthProvider = OAuthProvider.provider(providerID:auth:)
+    // `auth` defaults to `nil`
+    let provider = OAuthProvider(providerID: "id")
+    let _: String = provider.providerID
     #if os(iOS)
-      _ = OAuthProvider.credential(withProviderID: "id", idToken: "idToden", accessToken: "token")
-      _ = OAuthProvider.credential(withProviderID: "id", accessToken: "token")
-      _ = OAuthProvider.credential(withProviderID: "id", idToken: "idToken", rawNonce: "nonce",
-                                   accessToken: "token")
-      _ = OAuthProvider.credential(withProviderID: "id", idToken: "idToken", rawNonce: "nonce")
-      _ = OAuthProvider.appleCredential(withIDToken: "idToken",
-                                        rawNonce: "nonce",
-                                        fullName: nil)
+      let _: (String, String, String?) -> OAuthCredential =
+        OAuthProvider.credential(withProviderID:idToken:accessToken:)
+      let _: (AuthProviderID, String, String?) -> OAuthCredential =
+        OAuthProvider.credential(providerID:idToken:accessToken:)
+      // `accessToken` defaults to `nil`
+      let _: OAuthCredential =
+        OAuthProvider.credential(providerID: .apple, idToken: "")
+      let _: (String, String) -> OAuthCredential =
+        OAuthProvider.credential(withProviderID:accessToken:)
+      let _: (AuthProviderID, String) -> OAuthCredential = OAuthProvider
+        .credential(providerID:accessToken:)
+      let _: (String, String, String, String) -> OAuthCredential =
+        OAuthProvider.credential(withProviderID:idToken:rawNonce:accessToken:)
+      let _: (AuthProviderID, String, String, String?) -> OAuthCredential =
+        OAuthProvider.credential(providerID:idToken:rawNonce:accessToken:)
+      // `accessToken` defaults to `nil`
+      let _: OAuthCredential =
+        OAuthProvider.credential(providerID: .apple, idToken: "", rawNonce: "")
+      let _: (String, String, String) -> OAuthCredential =
+        OAuthProvider.credential(withProviderID:idToken:rawNonce:)
+
       provider.getCredentialWith(provider as? AuthUIDelegate) { credential, error in
       }
     #endif


Test patch: