Making Oauth2 work with slim

Hi, i am a bit new to slim, i am trying to implement a slim api project with Oauth capabilities, i have been using this skeleton https://github.com/pabloroca/slim3-simple-rest-skeleton which uses https://github.com/bshaffer/oauth2-server-php framework for it, for some reason i am not being able to make it work properly, and i am unsure if im just implementing something wrong. I added a user to users table and a client to the oauth_clients table, what i am no t sure is what do i have to put on the coulmn scope, or is this irrelevant? since i am able to get my access token but when using the token to get info out of the books table i get a 401 error.

I don’t know if this will help as I’m not familiar with those packages, but here is an example API app with OAuth 2 you may wish to look at.

A simple Slim Framework API with OAuth 2 authentication.

1 Like

Thx, that seems to be a good help and actually very lightweight way to implement, at least as i can see, the only thing is that i need it to work with MySQL and it is done for sqlite3 do you happen to know how to run that migrations package to a mysql database, i am looking and it seems it can be done but am having no luck.

I’ve never used doctrine/migrations so I’m not really sure, but it looks like the database type is defined here.

would it be much to ask to see if you get the same result as i do? when using this https://github.com/pabloroca/slim3-simple-rest-skeleton code, i get the token correctly, but for some reason the token won’t let me get authorization, it returns 401 error

If you use apache try adding this line in your .htaccess file

CGIPassAuth On
or
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]