No commit activity in last 3 years
No release in over 3 years
Firebase Ruby Auth
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3.8.0
~> 3.8.0
~> 0.71.0
~> 0.16.1
~> 3.5.1

Runtime

~> 2.2.2
 Project Readme

Ruby Firebase Auth

I have a Rails App where I need to authenticate firebase users on the server-side, not just in JavaScript.

I found these instructions from google: https://firebase.google.com/docs/auth/admin/verify-id-tokens

Unfortunately, it appears Google does not have support for Ruby. So, I made my own auth file!

Installation:

Using Rubygems:

gem install firebase-token-verify

Using Bundler

Add gem 'firebase-token-verify' to your Gemfile and run bundle install

Example use-case scenario:

  1. Lookup your firebase id and add it to your Ruby code, for example: PROJECT_ID = <your_firebase_project_id>
  2. Obtain a user token. You will need to be connected with JavaScript, or a mobile app, to obtain the user token. I usually obtain a user token using a JavaScript method similar to the one below:
user.getIdToken(true).then(token => {
  // Send this token to your Ruby application
})
  1. Setup some Ruby code to process the token
require 'firebase_ruby_auth'

PROJECT_ID = ENV['<your_firebase_project_id>']

FirebaseRubyAuth.new(PROJECT_ID).decode_token(token)