mariovalney / laravel-keycloak-web-guard

Simple Keycloak Guard to Laravel Web Routes - https://packagist.org/packages/vizir/laravel-keycloak-web-guard
146 stars 80 forks source link

How to replicate the web keycloak token for requests via api #68

Closed neemiasjr closed 6 months ago

neemiasjr commented 2 years ago

My auth.php

'guards' => [ 'web' => [ //'driver' => 'session', 'driver' => 'keycloak-web', 'provider' => 'users', ],

    'api' => [
        'driver' => 'keycloak-web',   <---- is corret?
        'provider' => 'users',
        'hash' => false,
    ],

How to replicate keycloak web token for ajax requests by laravel api.

My ajax requests come with empty token.

{"errors":[{"message":"Unauthenticated.","extensions":{"guards":["api"],"category":"authentication"},

mariovalney commented 2 years ago

Hi.

I guess you are trying to use a stateless API. I'll recommend it: https://github.com/robsontenorio/laravel-keycloak-guard