GoogleCloudPlatform / recaptcha-enterprise-flutter

Apache License 2.0
23 stars 8 forks source link

Feature request: Possibility to pass customAction with similar name as standard actions #6

Closed alexanderkorus closed 1 year ago

alexanderkorus commented 1 year ago

Hi,

currently it isn't possible to pass a customAction "Login" to the SDK, because this action parsed as default action, see e.g. iOS implementation:

if actionStr.caseInsensitiveCompare("login") == .orderedSame {
   return RecaptchaAction(action: .login)
} else if actionStr.caseInsensitiveCompare("signup") == .orderedSame  {
   return RecaptchaAction(action: .signup)
} else {
   return RecaptchaAction(customAction: actionStr) // our customAction "Login" never comes here
}

We defined a customAction also called "Login", so it needs to be passed to the enterprise SDK as customAction.

Greets, Alex

mcorner commented 1 year ago

What is not obvious is that a customAction named "login" is the same as .login. so there should be no need for this unless I am missing something?

Or is this a case sensitivity issue you are getting at where you want a "Login" custom action and .login (which translates to "login"?

In general we recommend that people use the default actions.

alexanderkorus commented 1 year ago

Yes, our custom action is case sensitive "Login" - and I'm not really sure why we don't use the default action for this case (I will ask), I'm just the app developer who needs to send the retrieving token from the SDK to the backend - and it currently fails because it translates to the default action ".login" .

In my opinion, I should be able to use the SDK in Flutter the same way I can in the native SDK, regardless of the recommended method.

mcorner commented 1 year ago

Ok, got it. I would recommend using "login" in the future.

That said actions are case sensitive in reality so I am thinking we might want to more closely mirror the custom action api of the sdk. I will work on it.

mcorner commented 1 year ago

@alexanderkorus Along with publishing 18.2.2 we changed the way we are handling recaptchaactions. They are now case sensitive and have a proper class to implement them.

This requires some minor changes to your code.

Thanks for the suggestions!