auth-firebase-jwt

Firebase JWT Authentication Strategy for randomstate/auth

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:

dependencies:
  auth_firebase_jwt:
    github: randomstate/auth-firebase-jwt

Usage

require "auth_firebase_jwt"

### Instantiation

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

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

  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 Connor Imrie - creator, maintainer
Repository

auth-firebase-jwt

Owner
Statistic
  • 0
  • 0
  • 0
  • 0
  • 2
  • over 6 years ago
  • March 21, 2018
License

MIT License

Links
Synced at

Mon, 25 Nov 2024 02:42:48 GMT

Languages