Categorygithub.com/isqad/firebase-auth-service

# README

Grpc-service for Firebase JWTs authentication

Go

Grpc-service for verification and authentication of Firebase JWTs

Usage

  1. Integrate auth interceptors into your grpc-project:
package main

import (
  "net"
  "google.golang.org/grpc"
  auth "github.com/isqad/firebase-auth-service/pkg/service"
)

type UsersAPIServer struct {
	UnimplementedUsersServer
}

func NewUsersAPIServer() (*UsersAPIServer, error) {
  return &UsersAPIServer{}
}

func (s *UsersAPIServer) Start() error {
  authAddr := os.Getenv("FIREBASE_AUTH_SERVICE_ADDRESS")

  l, err := net.Listen("tcp", authAddr)
	if err != nil {
		return err
	}

  a := auth.NewAuthInterceptor(authAddr)

	g := grpc.NewServer(
		grpc.UnaryInterceptor(a.AuthUnaryInterceptor),
    grpc.StreamInterceptor(a.AuthStreamInterceptor),
	)
	RegisterUsersServer(g, s)
	if err := g.Serve(l); err != nil {
		return err
	}

	return nil
}
  1. Build and run the service:
docker build -t your-name:firebase-auth-service:0.1.0 .
docker run --rm -d -p 50053:50053 --name firebase-auth-service your-name:firebase-auth-service your-name:firebase-auth-service:0.1.0
  1. Run your grpc-service.

Roadmap

  • Grabing google pub keys
  • Verification firebase auth JWT of User and extract his ID
  • grpc auth interceptors for services
  • Configuration
  • Tests
  • grpc error codes

# Packages

No description provided by the author
No description provided by the author