Class: FirebaseAuth::User
- Inherits:
-
Object
- Object
- FirebaseAuth::User
- Defined in:
- lib/firebase_auth/user.rb
Instance Attribute Summary collapse
-
#email ⇒ Object
Returns the value of attribute email.
-
#user_id ⇒ Object
Returns the value of attribute user_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(email, user_id) ⇒ User
constructor
A new instance of User.
Constructor Details
#initialize(email, user_id) ⇒ User
5 6 7 8 |
# File 'lib/firebase_auth/user.rb', line 5 def initialize(email, user_id) self.email = email self.user_id = user_id end |
Instance Attribute Details
#email ⇒ Object
Returns the value of attribute email.
3 4 5 |
# File 'lib/firebase_auth/user.rb', line 3 def email @email end |
#user_id ⇒ Object
Returns the value of attribute user_id.
3 4 5 |
# File 'lib/firebase_auth/user.rb', line 3 def user_id @user_id end |
Class Method Details
.authenticate_user(id_token, project_id) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/firebase_auth/user.rb', line 10 def self.authenticate_user(id_token, project_id) auth_service = FirebaseAuth.new(project_id) decoded_token = auth_service.verify_id_token(id_token) return nil unless decoded_token email = decoded_token["email"] # In a real-world application, you should lookup the user in your database # and validate the password or other credentials. User.new(email, self.user_id) # Password is not returned from Firebase end |