GodotNuts / GodotFirebase

Implementations of Firebase for Godot using GDScript
MIT License
554 stars 79 forks source link

Automatic anonymous authentication #172

Closed fenix-hub closed 3 years ago

fenix-hub commented 3 years ago

Related to #171 This PR will implement automatic anonymous authentication for unauthorized requests.

1) If a Firestore request is issued without the Client being authenticated (mail/password, token, etc.) an Anonymous authentication will be attempted automatically. Godot_v3 3-rc7_win64_vq5xUIfPyd

If Anonymous sign-in method is disabled (default option), the request will be skipped and the user will be notified. Godot_v3 3-rc7_win64_AKfpOVshTk If Anonymous sign-in method is enabled (manually set), the Client will be authenticated and the request (and further requests) will be processed. Godot_v3 3-rc7_win64_W2PR8n3bz5

The authenticated anonymous user can always be logged out with logout() function if needed.

2) A new signal is added in Auth for higher-level communication

# Emitted for each Auth request issued.
# `result_code` -> Either `1` if auth succeeded or `error_code` if unsuccessful auth request
# `result_content` -> Either `auth_result` if auth succeeded or `error_message` if unsuccessful auth request
signal auth_request(result_code, result_content)