Comments (4)
Generally, I think this is a nice idea to allow custom GetUserInfoFn
to be provided optionally. However, oath2 providers also force the scope, like here and that custom user mapper will be limited to the predefined (usually the minimal) scope only. Maybe it makes sense to allow passing the scope as well?
from auth.
another thing - I don't think the custom GetUserInfoFn should do the basic part at all. I.e. the basic mapping for ID, name, and picture is kind of a must-have anyway, and making the user's function to repeat the current implementation of the mapUser
won't be too friendly.
Probably we may want some ExtraUserFn to be invoked as a part of mapUser
and it won't touch the current fields but will be able to fill free-form User.Attributes
from auth.
Thanks @umputun. I think both of your remarks make a lot of sense.
Where do you think would be a good place to add this on the API surface?
- Just make it available for
AddCustomProvider
(this one has configurable scopes already) - Adapting
Params
inNewGithub(p Params)
to allow using the predefined one and instantiating it viaAddCustomHandler
- Add an "overload" for
AddProvider(name, cid, csecret string)
likeAddProviderWithOptions(name, cid, secret string, scopes []string, extraUserFn)
No 3 would be the most useful from my point of view. But you probably have a better overview and can think of issues with those approaches/other ideas?
from auth.
I went ahead and created a draft PR for this, as the implementation seemed simple enough. Let me know how you feel about it :)
from auth.
Related Issues (20)
- Support OpenID and 3rd party IdTokens with cookie-less authentication HOT 7
- Auth status handler panics if user didn't finish the auth process HOT 2
- Support work/school accounts from Azure AD in addition to personal Microsoft accounts
- Bug: auth should also check if xsrf token is set in cookies after checking via headers HOT 12
- twitter oauth now required to use oauth2 - unless you have elevated access HOT 4
- Give an access to bearer token, aquired during authentication proccess HOT 12
- Avatar store connection problems HOT 1
- Bug: (/_example) Using "Login with custom_123" results in "Invalid Request" HOT 2
- [Q] Why don't we use refresh token? HOT 2
- Password in GET is Insecure HOT 1
- Add Mastodon? HOT 1
- 2fa support
- Cannot disable avatar support HOT 4
- Dependency error while downloading auth on Go 1.20 HOT 4
- How to implement Google One Tap
- User email and info on Google Log in
- remove bluemonday as an unreliable dependency HOT 2
- Is there a way to use the token after login? HOT 1
- Planned support for anonymous auth? HOT 1
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 auth.