Skip to content

Passing auth token to web client #569

Closed Answered by jeromegamez
BrunoFenzl asked this question in Q&A
Discussion options

You must be logged in to vote

I'm assuming that you have in your Laravel Backend a relation between the Laravel User and the Firebase user, so that you can retrieve a Laravel User with a Firebase User ID, and a Firebase User with a Laravel User ID. I'm also assuming that you are using the kreait/laravel-firebase, even if it's just to drop it here, just in case you're not already using it 😅.

From the top of my head, I think this could be made possible by generating a Firebase custom token in the backend that the web client then can use to log into Firebase.

use Kreait\Laravel\Firebase\Facades\Firebase;

$claims = [/*...*/];

$customToken = Firebase::auth()
    ->createCustomToken(Auth::user()->firebase_uid, $claims)
  …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@BrunoFenzl
Comment options

@jeromegamez
Comment options

Answer selected by BrunoFenzl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants