PHP code example of unvurn / reauth

1. Go to this page and download the library: Download unvurn/reauth library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

unvurn / reauth example snippets


# config/auth.php
return [
    'guard' => 'bearer',

    'guards' => [
        # this 'bearer' entry is implied within reauth package itself.
        # you don't have to duplicate it.
        'bearer' => [
            'driver' => 'bearer',
            'pipelines' => [
                [
                    'resolver' => OpaqueAccessTokenResolver::class,
                    'users' => AccessTokenUserProvider::class
                ]
            ]
        ],
        'json' => [
            'driver' => 'json',
            'pipelines' => [
                'custom_id' => [
                    'resolver' => function ($value, &$decoded) {
                        $decoded = $value;
                        return [ 'custom_id' => $value ];
                    },
                    // 'users': can be omitted
                ]
            ],        
        ]
    ]
];

            'pipelines' => [
                [
                    'resolver' => OpaqueAccessTokenResolver::class,
                    // ...
                ]
            ]

            'pipelines' => [
                [
                    'resolver' => function ($value, &$decoded) {
                        $decoded = $value;
                        return [ 'custom_id' => $value ];
                    },
                ]
            ]

>                   'resolver' => function ($value) {
>                       return [ 'custom_id' => $value ];
>                   },
> 
shell
$ php artisan vendor:publish --tag=reauth-migrations