-
-
Notifications
You must be signed in to change notification settings - Fork 470
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
Correct way to access the "request" object during "token endpoint". #182
Comments
What headers do you need access to and why? Sent from my iPhone
|
I have a use case to accessing the request as well. We have a multitenant application, and we get the connection to the tenant's database per request, so the database connection lives on the request object. So in order to search for clients or tokens, I need |
Taking model data onto a request is probably not a pattern that I would be encouraging. As a workaround,
Again, that's definately not the intent and purpose behind this, but it should work as a workaround. |
Agreed, it's been kind of a pain having it in the request. It does seem more "functional", and makes it easier to maintain a single-tenant and multi-tenant codebase in the same place when you do database-level multitenancy, but has its own share of issues and tradeoffs. I'm okay with the current set of functionality without extension to support these edge cases. |
it was very painfull to fid way to pass request object to oauth2orize.exchange.password. it will be better to have this option by default, instead of writing workarounds such as
after hour of digging in code and googling |
Can people posting here please provide descriptions of what data is in the request that is needed (and missing) in what is currently passed to grants and exchanges? Understanding use cases helps implement the best solution. Thanks. |
for example i need to know user's ip, cause some customers want to grant access for their users only if their ip in whitelist. so i need access to request ip. best solution is simple provide request for |
+1 |
2 similar comments
+1 |
+1 |
+1. I need to access user entity requested from DB after sever.token() to use it on response 'finish' event. |
+1. I need to access the client IP (and the x-forwarded header, etc) |
+1 I'd like to access |
This has been addressed with passReqToCallback as shown in http://www.passportjs.org/docs/authorize/ |
+1 i'd like to save some user-info from headers right after successful grant (password exchange), @jaredhanson How would that possible. |
+1 |
+1 I have local login and social login for my app. So once user successfully logged in via any social account I want to set |
I want to access the request object of the token endpoint so that I'll know the request headers accessing it.
As shown in this section:
I understand that the
server.token()
part returns the access tokens in the response of the POST /token endpoint.So I tweaked that part to in order for me to access the
request
object which got me here:I can access the request headers but now I cannot get the right tokens. Is there anyway to implement this correctly?
thanks
The text was updated successfully, but these errors were encountered: