firebase / firebase/firebase-android-sdk
Firebase Auth: Exception when signup has been blocked by cloud function is too generic
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 710
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 31
Description
### [READ] Step 1: Are you in the right place?
I think so.
### [REQUIRED] Step 2: Describe your environment
* Firebase Component: Auth
* Component version: 21.3
### [REQUIRED] Step 3: Describe the problem
When the signup is blocked by the cloud function it returns a rather generic FirebaseException with the message:
```
An internal error has occurred. [ BLOCKING_FUNCTION_ERROR_RESPONSE:HTTP Cloud Function returned an error: {"error":{"message":"Signup with provider [google.com](http://google.com/) not allowed","status":"PERMISSION_DENIED"}} ]
```
This should be either a specific Exception (like FirebaseAuthBlockingFunctionErrorException) or a FirebaseAuthException with a proper code set.
Login logic shouldn't have to parse the returned exception message for magic strings or have to parse JSON to be able to react to errors.
#### Steps to reproduce:
1. Set up Firebase Auth with a [blocking cloud function](https://firebase.google.com/docs/functions/auth-blocking-events?gen=2nd)
2. Sign up with a data that matches the blocking criteria
#### Relevant Code:
-
Contributor guide
Assessment
This issue has not been assessed yet.