Skip to content

Instantly share code, notes, and snippets.

Andrew Sheelan Paliyan andrewsheelan

View GitHub Profile
@andrewsheelan
andrewsheelan / firebase.rb
Created Feb 14, 2018
Ruby Token generator for Firebase Admin SDK
View firebase.rb
################################################################################################################
# Requires Firebase Database account and a JSON file. This can be placed in config/initalizers if using Rails
# Download it from the account > service area and renamed it as privatekey.json
# Also requires ruby-jwt gem.
# Usage: Firebase.generate_token(uid)
#
# Rule in Firebase to authorize based on user_id for this token (o_payload passes user_id):
# Path: https://#{project_id}.firebaseio.com/users/#{uid}
# {
# "rules": {
You can’t perform that action at this time.