Skip to content
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

feature request: Discord Connector: Grab guilds to allow access management #6844

Open
IngwiePhoenix opened this issue Dec 2, 2024 · 2 comments
Labels
feature-request Something cool or not cool

Comments

@IngwiePhoenix
Copy link

What problem did you meet?

While playing around with a demo instance outside my cluster, I tested the Discord connector and found that it obtained and returned everything I asked. Except for the guilds, since this is an additional request. So I looked for this feature in the connector's code here: https://github.com/logto-io/logto/blob/master/packages/connectors/connector-discord/src/index.ts#L90-L141

The concrete problem I am trying to solve is to only allow access to my services to users that are in predetermined servers (guilds).

Describe what you'd like Logto to have

After obtaining accessToken, you can make an additional request to retrive the users' guilds if the guilds scope is present: (config.scope ?? defaultScope).split(" ").includes("guilds").

Storing this in the users' extra data field could allow for mapping groups per server (for instance, only allowing access to some services if the user is part of a certain guild). This way, you could safely expose a service behind LogTo and oauth2-proxy, but only allow users in a particular server to actually become authorized.

That said, I am not sure if LogTo actually has a mapping system like that though... Still, I think this would be quite useful!

Thank you and kind regards,
Ingwie

@xiaoyijun
Copy link
Contributor

Hi @IngwiePhoenix, thank you for your detailed feedback and for sharing your use case. This is a great suggestion, and we’ll definitely consider it for future improvements.

In the meantime, we’d also welcome any code contributions if you’d like to help implement this feature. Feel free to open a pull request or discuss further in the repository.

@xiaoyijun xiaoyijun added the feature-request Something cool or not cool label Dec 9, 2024
@IngwiePhoenix
Copy link
Author

I am legit in the process of learning TypeScript. So I might try to put it in myself. :)

I come from PHP, C and C++ and have lately learned Go. So it'll take me a minute, especially with all the React stuff in the mix too...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Something cool or not cool
Development

No branches or pull requests

2 participants