-
Notifications
You must be signed in to change notification settings - Fork 142
ApiToken docs and filter update. #417
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
request() ?
Do you mean service('request') ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't mind him, Laravel gets the bills paid. Yes he meant to use the service.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
MGatner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.