https://github.com/randomstate/auth-firebase-jwt
Firebase JWT Authentication Strategy for randomstate/auth
https://github.com/randomstate/auth-firebase-jwt
Last synced: 8 months ago
JSON representation
Firebase JWT Authentication Strategy for randomstate/auth
- Host: GitHub
- URL: https://github.com/randomstate/auth-firebase-jwt
- Owner: randomstate
- License: mit
- Created: 2018-03-21T08:50:51.000Z (about 8 years ago)
- Default Branch: develop
- Last Pushed: 2018-03-21T19:08:17.000Z (about 8 years ago)
- Last Synced: 2025-06-21T07:40:55.177Z (9 months ago)
- Language: Crystal
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Firebase JWT Auth Strategy
`randomstate/auth-firebase-jwt` provides a Firebase JWT strategy for `randomstate/auth`
## Installation
Add this to your application's `shard.yml`:
```yaml
dependencies:
auth_firebase_jwt:
github: randomstate/auth-firebase-jwt
```
## Usage
```crystal
require "auth_firebase_jwt"
```
###Â Instantiation
```crystal
strategy = Auth::Strategies::Firebase::JWT.new "{PROJECT_ID}" # PROJECT_ID is your Firebase Project ID
manager = Auth::Manager.new
manager.use :jwt, strategy
```
### Converting FirebaseUser to your User object
```crystal
strategy.when_converting do | firebase_user |
my_user = User.new
my_user.id = firebase_user.user_id
my_user.email = firebase_user.email
my_user # must return your own user object
end
```
The following properties are available on the FirebaseUser object
```crystal
user_id: String,
auth_time: Time,
display_name: (String | Nil),
email: (String | Nil),
email_verified: (Bool | Nil),
phone_number: (String | Nil),
```
## Contributing
1. Fork it ( https://github.com/randomstate/auth-firebase-jwt/fork )
2. Create your feature branch (git checkout -b my-new-feature)
3. Commit your changes (git commit -am 'Add some feature')
4. Push to the branch (git push origin my-new-feature)
5. Create a new Pull Request
## Contributors
- [cimrie](https://github.com/cimrie) Connor Imrie - creator, maintainer