No commit activity in last 3 years
No release in over 3 years
Retrieved UID on server side using ID token sent from client
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.16
~> 10.0

Runtime

~> 2.1
 Project Readme

FirebaseIdtoken

Retrieved auth UID using ID token sent from client. (Ruby implementation)

Installation

Add this line to your application's Gemfile:

gem 'firebase_idtoken'

And then execute:

$ bundle

Or install it yourself as:

$ gem install firebase_idtoken

Configuration

FirebaseIdtoken.configure do |config|
  config.project_id = 'my-project-id'      # Default: nil
  config.cache_path = 'path/to/cache_file' # Default: tmp/firebase_public_key
  config.cache_time = 60 * 60 * 2          # Default: 60 * 60
end

Usage

require('firebase_idtoken')

# Token comes from client side
token = 'eyJhbGciOiJSUzI1NiIs.....ajmRoVHvI7A'
FirebaseIdtoken.verify(token)

# Result
=> {"uid"=>"oyvaFVD2xxxxxxxxZPFVnH1X8Xv1",
 "decoded_token"=>
  {:payload=>
    {"iss"=>"https://securetoken.google.com/your-project",
     "name"=>"User Name",
     "picture"=>
      "https://lh5.googleusercontent.com/-xxxxxx/xxxxxxxxx/AAAAAAAAAT4/xxxxxxx/photo.jpg",
     "aud"=>"your-project",
     "auth_time"=>1522240359,
     "user_id"=>"oyvaFVD2xxxxxxxxZPFVnH1X8Xv1",
     "sub"=>"oyvaFVD2xxxxxxxxZPFVnH1X8Xv1",
     "iat"=>1522240388,
     "exp"=>1522243988,
     "email"=>"youremail@example.com",
     "email_verified"=>true,
     "firebase"=>
      {"identities"=>
        {"google.com"=>["108658900000000862749"],
         "email"=>["youremail@example.com"]},
       "sign_in_provider"=>"google.com"}},
   :header=>
    {"alg"=>"RS256", "kid"=>"f5b18276a4866100000000c3e9434974d1f1db51"}}}

Related Docs

License

The gem is available as open source under the terms of the MIT License.