cesargaray's avatar

[SOLVED] Configure Oauth2 server

Hello everybody!!.. this is my firts post... i'm really new in lumen and lavarel. I try to configure ouath2 server in lumen following this github fork https://github.com/esbenp/oauth2-server-lumen but i cant find the config folder to copy the oauth2.php. I skip this step and when i try to access to the middleware ouath i recieve this message:

ReflectionException in Container.php line 776: Class Optimus\OAuth2Server\Middleware\OauthMiddleware does not exist

When debug the code, i found who the array config, that must have all the configurations, is empty.

Please excuse me if my question is silly but yesterday i lost a couple of hours and can't find the way. Thanks all for your time.

0 likes
8 replies
beznez's avatar

That folder should be in your root directory: myapp/config.

sitesense's avatar

Did you miss this step:

Copy config

Copy vendor/lucadegasperi/oauth2-server-laravel/config/oauth2.php to your own config folder (config/oauth2.php in your project root). It has to be the correct config folder as it is registered using $app->configure().

cesargaray's avatar

Hi, thanks for the comments. @beznez , now i'm in the office, in the night i'll test it, if the folder doesn't exists can create it? @sitesense yes, i skyp this step because i don´t know where put the ouath2.php
Thanks again for your time.

beznez's avatar

@cesargaray You shouldn't have to create it; it should already be there. It's the configuration folder for Laravel. Inside of it are config files for the app, database, mail, etc.

cesargaray's avatar

Hi all, i solved the problem. The path to the config folder is vendor\laravel\lumen-framework\config in my case. Thanks a lot for your help. Bye!!

Andreyco's avatar

Although marked as solved, I cannot look at comments which state "you should put it in app/config."

Configuration files should be located in config folder, in root of your project.

Reference: http://lumen.laravel.com/docs/configuration#configuration-files
Lumen will use your copy of the configuration file if you copy and paste one of the files into a config directory within your project root.

After you add your own config file or copy one of default config files, don't forget to register it via $app->configure('{name}');

Please or to participate in this conversation.