Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow authenticating users #390

Closed
wants to merge 1 commit into from
Closed

Conversation

jeromegamez
Copy link
Member

@jeromegamez jeromegamez commented Mar 2, 2020

The changes in this branch allow authenticating users with given credentials (or no credentials at all :))

  • Kreait\Firebase\Auth::signInAnonymously()
  • Kreait\Firebase\Auth::signInAsUser($userOrUid, array $claims = null)
  • Kreait\Firebase\Auth::signInWithCustomToken($customToken)
  • Kreait\Firebase\Auth::signInWithEmailAndPassword($email, $clearTextPassword)
  • Kreait\Firebase\Auth::signInWithRefreshToken($refreshToken)

Todo

  • Authenticate with Identity Provider Credentials (= Access- or ID Tokens from federated users)
  • Authenticate anonymously
  • Use the new methods instead of going through Kreait\Firebase\Auth\ApiClient, where applicable
  • Documentation

How to test

Add this to the composer.json file of your project:

"kreait/firebase-php": "dev-user-authentication"

The methods mentioned above will return an instance of Kreait\Firebase\Auth\AuthenticationResult with the following getters and checkers:

  • idToken(): Kreait\Firebase\Auth\IdToken
  • accessToken(): Kreait\Firebase\Auth\AccessToken (not always set)
  • refreshToken(): Kreait\Firebase\Auth\RefreshToken
  • isExpired(): bool

For the rest, you'll have to dig through the code 馃槄

:octocat:

@codecov
Copy link

codecov bot commented Mar 2, 2020

Codecov Report

Merging #390 into master will increase coverage by 0.21%.
The diff coverage is 97.64%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #390      +/-   ##
============================================
+ Coverage     96.48%   96.69%   +0.21%     
- Complexity     1204     1260      +56     
============================================
  Files           139      146       +7     
  Lines          3099     3239     +140     
============================================
+ Hits           2990     3132     +142     
+ Misses          109      107       -2     

@baudev
Copy link

baudev commented Mar 12, 2020

Amazing PR!
How soon do you plan to release it?

@jeromegamez
Copy link
Member Author

@baudev I鈥榤 currently working on the documentation, it shouldn鈥榯 be too long 馃

@jeromegamez
Copy link
Member Author

Merged with e9be70f

@jeromegamez jeromegamez deleted the user-authentication branch March 16, 2020 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants