Comments (7)
Hi there,
Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels:
However, this issue will not be locked and everyone is still free to discuss solutions to your problem!
Thanks.
from sanctum.
Not sure how this can be mistaken for a support question.
from sanctum.
Hi @nicoqh. You seem to be asking questions about how things work in Sanctum. That's a support question. This issue tracker is only for reporting bugs. There's also no bug template filled in here.
from sanctum.
Hi, @driesvints
No, I questioned the guard's implementation. And I assumed it was a good idea to ask a question about the design decisions before possibly submitting a PR. I'd open a discussion, but there's no such feature enabled on the repo.
from sanctum.
@driesvints I totally agree with @nicoqh. This does belong here as its not so much a support question, but a technical question in regards to the code it self. We know what the issue is and we know how to fix it, but we need some input from the maintainers before doing anything like suggesting a change through a PR. I believe the need to take issues to zero is taking precedence over actually carefully reading the issue.
But in any case this is why I landed here:
I came here after I was reading Sanctum's code, because I have a specific case where the users would be on 1 connection (server a) and the tokens on another (server b) and I was unpleasantly surprised to see this unnecessary tight coupling preventing me from otherwise easily implementing this.
Sanctum also provides a Laravel\Sanctum\Contracts\HasApiTokens-interface, but that is surprisingly only used in DocBlock annotations!?
Using the "trait" check is probably done to prevent users from also having to add an implements HasApiToken
interface besides adding the trait.
Ideally the supportsTokens
should check wether it supports tokens by checking if $tokenable
implements the interface and not the very specific trait. This might be a to large of a change to do without a version bump perhaps?
Another solution might be to make it possible to "overwrite" the supportsTokens
logic by perhaps giving us the option to set a callable that would be used instead if set. I have seen this pattern used more within the Laravel code base (don't have an example on hand, but I know they are there).
edit:
So all it takes is this small change: 4.x...Ilyes512:sanctum:update-supports-token-logic-by-checking-contract
Funny thing is, I was expecting one or more tests to fail, but it didn't because the model that is used with the tests already explicitly implements the HasApiTokens
-interface. See https://github.com/laravel/sanctum/blob/4.x/workbench/app/Models/User.php#L9
from sanctum.
I believe the need to take issues to zero is taking precedence over actually carefully reading the issue.
I wouldn't be too quick to judge. It's easy to judge another if you're not in their shoes. We definitely welcome PR's if there's something to be improved here which is what you've done. So let's see how it goes.
from sanctum.
I wouldn't be too quick to judge. It's easy to judge another if you're not in their shoes.
True, I can only imagine you and the rest of the Laravel team are quite busy maintaining existing code and delivering awesome new stuff. And I am thank full of that!
It's just sometimes it feels like tickets get closed to quick, but I also understand you need to prioritise stuff.
Also I actually don't need the change anymore... but I still think it's better to check against the interface if you want to enable people changing the specific implementation detail.
from sanctum.
Related Issues (20)
- Support expiration by seconds HOT 1
- Guest middleware not working properly with Sanctum + Inertia (+ Vue) HOT 1
- Auth guard [sanctum] is not defined. HOT 1
- Direct links to API routes HOT 1
- Migration file conflicts HOT 1
- Standalone tokens (without user model / tokenable_type relationship) HOT 1
- Update from 2.x to 3.x - isValidBearerToken() - ctype_digit() HOT 1
- SPA authentication leads to '400: bad request error' HOT 1
- Update to Laravel 11 causes 401 issues when using stateful domains HOT 1
- Issue with overriding default model HOT 1
- Could we have a more descriptive method on the request to access the model? HOT 2
- Unable to validate password using validation rules HOT 3
- Only in Sanctum 3 - Fix/unable to logout HOT 1
- Sanctum v3.3 - unable to logout HOT 1
- Sanctum should not change session config HOT 3
- Login succeeded, log out, then log in to another account error
- Handle JSON Response in guest Middleware - RedirectIfAuthenticated out of the box HOT 1
- Unauthenticated or infinite loop HOT 3
- Directly assign a guard to the sanctum
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sanctum.