<commit_before><?php

declare(strict_types=1);

namespace A1comms\GaeSupportLaravel\Auth\Http\Controllers\Concerns;

use A1comms\GaeSupportLaravel\Auth\Token\Firebase as Token;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\Cookie as CookieHelper;
use Symfony\Component\HttpFoundation\Cookie;

trait HandlesFirebaseLogin
{
    /**
     * fetchSessionToken.
     */
    protected function fetchSessionToken(string $idToken, string|null $tenantId = null): string
    {
        return Token::fetchToken(
            env('FIREBASE_PROJECT'),
            $idToken,
            (3600 * 24 * 7),
            $tenantId,
        );
    }
<commit_msg>Firebase Auth: Trait: use Request and fetchSessionTokenFromCookie<commit_after><?php

declare(strict_types=1);

namespace A1comms\GaeSupportLaravel\Auth\Http\Controllers\Concerns;

use A1comms\GaeSupportLaravel\Auth\Exception\InvalidTokenException;
use A1comms\GaeSupportLaravel\Auth\Token\Firebase as Token;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cookie as CookieHelper;
use Symfony\Component\HttpFoundation\Cookie;

trait HandlesFirebaseLogin
{
    /**
     * fetchSessionToken.
     */
    protected function fetchSessionToken(string $idToken, string|null $tenantId = null): string
    {
        return Token::fetchToken(
            env('FIREBASE_PROJECT'),
            $idToken,
            (3600 * 24 * 7),
            $tenantId,
        );
    }

    /**
     * fetchSessionTokenFromCookie.
     */
    protected function fetchSessionTokenFromCookie(Request $request): string
    {
        $cookieName = config('gaesupport.auth.firebase.cookie_name');

        if ($request->hasCookie($cookieName)) {
            return $request->cookie($cookieName);
        }

        throw new InvalidTokenException('Cookie Not Found', 0);
    }

{'fraction_non_alphanumeric': 0.1031703385276733, 'fraction_numerical': 0.011821601289629231, 'mean_word_length': 3.2126696832579187, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2773949', 'n_tokens_mistral': 565, 'n_tokens_neox': 560, 'n_words': 98}