Conversation
@lonnieezell Thanks for this PR. It will be nice to have an CLI command to generate Token for user at start to test functionality before implementing the whole flow with user interface to interact with API access. |
|
This looks great! It's big, and I am short on time so will have to come back to it. Ideally you pull the token changes out to its own PR to make this smaller for review 🫣 |
Co-authored-by: MGatner <mgatner@icloud.com>
|
@MGatner doc changes integrated. |
|
The following errors have nothing to do with this PR. I send #423 to fix. https://github.com/codeigniter4/shield/runs/8220322852?check_suite_focus=true |
docs/guides/api-tokens.md
Outdated
|
|
||
| ```php | ||
| $routes->get('/access/token', static function() { | ||
| $token = auth()->user()->generateAccessToken(request()->getVar('token_name)); |
There was a problem hiding this comment.
request() ?
Do you mean service('request') ?
There was a problem hiding this comment.
Don't mind him, Laravel gets the bills paid. Yes he meant to use the service.
There was a problem hiding this comment.
Dang it :) I've considered adding a request() and response() helper method for years on this framework, but never did. I actually had to go double-check the code to ensure we didn't have it lol. But, yes, that's what I meant.
|
We need a review process for reviews 🤦♂️ Thanks for catching wha to missed @kenjis. |
Co-authored-by: kenjis <kenji.uui@gmail.com>
|
@MGatner if you guys have the time and/or desire feel free to finish it up. I merged the suggestions. |
Added the first of a handful of guides stepping through setup and use Access Tokens to handle various situations. This one covers generic API requests.
Along the way I discovered that the
TokenAuthfilter didn't support checking against a scope, so I updated the filter to handle a single permission added when used as a route filter.