firebase / firebase-ios-sdk

Firebase SDK for Apple App Development
https://firebase.google.com
Apache License 2.0
5.58k stars 1.46k forks source link

[v11] Recaptcha Enterprise integration #13154

Closed paulb777 closed 2 months ago

paulb777 commented 3 months ago

Description

Verify Recaptcha Enterprise in v11. Since it relies on reflection, the code is a bit tricky. Follow-up to #13151

Reproducing the issue

Click Initialize Recaptcha Config in the Sample App

Firebase SDK Version

11.0.0

Xcode Version

15.3

Installation Method

Swift Package Manager

Firebase Product(s)

Authentication

Targeted Platforms

iOS

Relevant Log Output

No response

If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet
```json Replace this line with the contents of your Package.resolved. ```

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet
```yml Replace this line with the contents of your Podfile.lock! ```
paulb777 commented 3 months ago

More investigation today on the following block of code:

Two issues:

  1. Missing defaultAction in map leads to not linked failure:
    (lldb) po action 
    FirebaseAuth.AuthRecaptchaAction.defaultAction
    (lldb) po actionToStringMap 
    ▿ 3 elements
    ▿ 0 : 2 elements
    - key : FirebaseAuth.AuthRecaptchaAction.signUpPassword
    - value : "signUpPassword"
    ▿ 1 : 2 elements
    - key : FirebaseAuth.AuthRecaptchaAction.signInWithPassword
    - value : "signInWithPassword"
    ▿ 2 : 2 elements
    - key : FirebaseAuth.AuthRecaptchaAction.getOobCode
    - value : "getOobCode"
  2. Fails to do reflection:
    po NSClassFromString("RecaptchaAction")  as? any RCAActionProtocol.Type
    nil

    Screenshot 2024-06-26 at 4 45 51 PM

paulb777 commented 3 months ago

Why does this cast fail?

Screenshot 2024-06-27 at 8 51 16 PM