Giter Site home page Giter Site logo

sacsand / gofiber-firebaseauth Goto Github PK

View Code? Open in Web Editor NEW
22.0 2.0 9.0 123 KB

Firebase Authentication Middleware for Go Fiber framework.

License: MIT License

Makefile 1.27% Go 98.04% Shell 0.69%
go fiber firebase middleware gofiber authentication authentication-middleware firebase-authentication firebase-console ignore-urls fiber-framework

gofiber-firebaseauth's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gofiber-firebaseauth's Issues

How to Access specific values from claims interface{}

This is more likely my lack of understanding of how Go works than a gofiber-firebaseauth specific problem.

In the examples it shows accessing the claims object from context and printing it out.

claims := c.Locals("user")
fmt.Println(claims)

This works and I see this

{false mzeijVVkt6MDFQWmWBgzqr79taq2 [email protected]}

From looking at the source, it loads in the private user struct into the context which is populated by fields from Token from firebase. This results in a generic interface{} for claims and I cannot figure out how to access each field, individually.

I looked into type assertion, reflection etc. but not sure what is needed here.

Thanks for the help.

Get the token from cookie.

I'm new in web developing.

In gofiberfirebaseauth.go line 45 "IDToken := c.Get(fiber.HeaderAuthorization)".
Can we get the IDToken from cookie value? instead.
Like in gofiber/jwt that you can select the method (jwtFromCookie(), jwtFromHeader()).

Trying to get `email` and `email_verified` even when `CheckEmailVerified: false` is set in Config which leads to `interface conversion: interface {} is nil, not string`

Trying to get email and email_verified even when CheckEmailVerified: false is set in Config which leads to interface conversion: interface {} is nil, not string

Error triggers when user does not have a email id (when using only phone auth)

// Set authenticated user data into local context
    c.Locals(cfg.ContextKey, User{
    Email:         token.Claims["email"].(string),
    EmailVerified: token.Claims["email_verified"].(bool),
    UserID:        token.Claims["user_id"].(string),
    })
Screenshot 2023-10-06 at 7 52 18 PM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.