Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth guard is not defined. #21

Closed
snakemastr opened this issue Sep 14, 2020 · 6 comments
Closed

Auth guard is not defined. #21

snakemastr opened this issue Sep 14, 2020 · 6 comments

Comments

@snakemastr
Copy link

I have a fresh install octobercms with Octobro/Api and was looking for a good oAuth plugin.
Unfortanetly I am getting the error Auth guard is not defined when I'm trying to login.
I am creating a login request with Postman POST request and have submitted my fields in the form-data body.

Also, can I create a user for the API only? Right now it is mixing with my customers users but I would like to restrict the API user(s) or group to the API only.

@vdomah
Copy link
Owner

vdomah commented Sep 14, 2020

Hi,
1st question, please provide more details if you can.

2nd question: you can define your own user model in config by setting env variable:

'model' => env('AUTH_PROVIDERS_USERS_MODEL', '\RainLab\User\Models\User'),

@snakemastr
Copy link
Author

snakemastr commented Sep 15, 2020

  1. I was typing my reply as I noticed that the guard name was empty. If OctoberCMS has a config/auth.php, the auth.php in your plugin is ignored.
    Does this mean my way of installing plugins is wrong or is this desired behaviour? I would think the configs are extending each other, not overriding completely.. I use the backend plugin manager for installation.
    I have now pasted your config in my auth.php and the plugin works as expected! Awesome :-D

  2. Also good to know. One of the used plugins creates customer model on login if no model is present so I have to catch that in case of my own User.

Thank you so much

@snakemastr
Copy link
Author

Ah, config/auth.php was added with the recent upgrade to Laravel V6 (Sep 8).

@vdomah
Copy link
Owner

vdomah commented Sep 15, 2020

About config/auth.php 1 that surprised me, because I fixed that in past plugin releases. Thanks for pointing that it’s Laravel 6 problem, I’ll investigate

@vdomah vdomah closed this as completed Sep 15, 2020
@beatriznbarroso
Copy link

Hey @vdomah I just had the same issue with your Plugin version 1.0.12 and Laravel 6, is this part of a new release?

@sanPuerquitoProgramador

If you are using WinterCMS you can add the content of oc-jwtauth/config/auth.php inside wintercms/config/auth.php and, considering you are using the Winter version of Users pluging you need to change too


    'providers' => [
        'users' => [
            'driver' => env('AUTH_PROVIDERS_USERS_DRIVER', 'eloquent'),
            'model' => env('AUTH_PROVIDERS_USERS_MODEL', '\RainLab\User\Models\User'),
        ],

for

    'providers' => [
        'users' => [
            'driver' => env('AUTH_PROVIDERS_USERS_DRIVER', 'eloquent'),
            'model' => env('AUTH_PROVIDERS_USERS_MODEL', '\Winter\User\Models\User'),
        ],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants