Skip to content
This repository has been archived by the owner on Jun 17, 2020. It is now read-only.

Authenticate members in bounty voting: Discord to xataface via OAuth #413

Closed
dckc opened this issue Feb 23, 2018 · 24 comments
Closed

Authenticate members in bounty voting: Discord to xataface via OAuth #413

dckc opened this issue Feb 23, 2018 · 24 comments
Assignees
Labels
Development splitting into core-dev, developer-education, ...? (guides: @dckc, ...)

Comments

@dckc
Copy link
Contributor

dckc commented Feb 23, 2018

In the interest of tracking membership in the bounty process (e.g. #391), let's integrate with discord, using the guild and role API.

Thanks to @hyperevo, this is implemented and deployed:

This was originally discussed in #260.

See also #279 for thoughts on using the blockchain to certify coop membership.

@kaka56 kaka56 added the zz-Operations NEEDS SPONSOR guides: @TrenchFloat, @jimscarver @Tonyprisca13 label Feb 24, 2018
@kaka56 kaka56 changed the title authenticate members in bounty voting: discord to xataface via OAuth O> authenticate members in bounty voting: discord to xataface via OAuth Feb 24, 2018
@BelovedAquila BelovedAquila added the bounty-contract changes to the bounty system operating agreement; see CONTRIBUTING.md label Feb 24, 2018
@BelovedAquila BelovedAquila changed the title O> authenticate members in bounty voting: discord to xataface via OAuth O> Authenticate members in bounty voting: discord to xataface via OAuth Feb 24, 2018
@dckc dckc added Development splitting into core-dev, developer-education, ...? (guides: @dckc, ...) and removed zz-Operations NEEDS SPONSOR guides: @TrenchFloat, @jimscarver @Tonyprisca13 bounty-contract changes to the bounty system operating agreement; see CONTRIBUTING.md labels Feb 24, 2018
@dckc
Copy link
Contributor Author

dckc commented Feb 24, 2018

This isn't a change to the bounty contract, @BelovedAquila .

@dckc dckc changed the title O> Authenticate members in bounty voting: discord to xataface via OAuth Authenticate members in bounty voting: discord to xataface via OAuth Feb 24, 2018
@hyperevo
Copy link

So I managed to get php working, communicating, and authenticating with Discord's Oauth. I am able to grab a list of guilds that the user belongs to. However, it doesnt allow me to see the user's roles within the guild. Since we are currently identifying coop members by their roles within the guild, this specific method doesn't seem like it will work.

It looks like I can set up a discord bot, give that bot access to the guild, and get a list of users and roles for the guild. So the authentication will work in 2 parts: 1) Authenticate the user with OAuth and find their unique username, 2) Ask the bot for a list of users with roles in the guild, check to see if the authorized user has the coop member role.

@dckc
Copy link
Contributor Author

dckc commented Feb 24, 2018

Oh! I just realized: the app uses github names, primarily. So this discord stuff shouldn't be the primary login mechanism, but rather a way to set a "verified coop member" flag.

@dckc
Copy link
Contributor Author

dckc commented Feb 24, 2018

@hyperevo are you interested to do Github OAuth too?

@BelovedAquila
Copy link

Alright, Pardon. @dckc

@BelovedAquila BelovedAquila changed the title Authenticate members in bounty voting: discord to xataface via OAuth Authenticate members in bounty voting: Discord to xataface via OAuth Feb 24, 2018
@hyperevo
Copy link

Even if we aren't using Discord for the primary login, we still have to have them login to their Discord account to prove it is their account. I guess it can be a one time thing, and once they are verified we can just add it to the database.

Since I have already been reading OAuth documents I might as well take the github OAuth too while its fresh in my mind if nobody else wants it.

@dckc
Copy link
Contributor Author

dckc commented Feb 25, 2018

yes, we still have to have them login to discord.

@BelovedAquila
Copy link

BelovedAquila commented Feb 25, 2018

@hyperevo you are making a point, but what method of verification is to be used to verify the discord account? Because was wondering if it should be a video verification, and since the discord verification is likely to be a ONE TIME THING like you stated, then I suggest it should be carefully and judiciously done, to ensure that no one is wrongly verified or any blur verification is made, because one wrong verification made is enough to alter the aim for a long while. Still on a suggestive grounds, making the verification on at least an annual basis wouldn't be a bad idea.

@dckc
Copy link
Contributor Author

dckc commented Feb 25, 2018

The KYC process is separate; the results of that process go into discord roles. The task here is purely technical: access those roles.

@hyperevo
Copy link

hyperevo commented Mar 3, 2018

I fully implemented the discord Oauth coop member verification at https://github.com/hyperevo/rchain-dbr. Still in the testing phase to ensure security. Right now the user can log in via github oauth, and then verify coop membership via discord oauth.

@dckc
Copy link
Contributor Author

dckc commented Mar 3, 2018

Your repo doesn't seem to share history with mine; it looks like you didn't start by forking / cloning.

Oh well... we can clean that up in due course...

@hyperevo
Copy link

hyperevo commented Mar 3, 2018

Oops. I am fixing that now. Just realized I broke the history when I deleted xataface. I will have it all merged with the fork of your code in a few minutes.

@hyperevo
Copy link

hyperevo commented Mar 3, 2018

Fixed now.

@dckc
Copy link
Contributor Author

dckc commented Mar 8, 2018

@hyperevo how did you set up the discord bot? What permissions? Did you "Require OAuth2 Code Grant"?

@dckc
Copy link
Contributor Author

dckc commented Mar 8, 2018

What's up with 'limit' => 1000? The coop has around that many members already.


			#Get a list of members, along with their role id's
			$guild_members = $discord->guild->listGuildMembers(['guild.id' => intval($this->ini_array['rchain_guild_id']), 'limit' => 1000]);

@dckc
Copy link
Contributor Author

dckc commented Mar 8, 2018

I got it almost working...

@lapin7
Copy link
Contributor

lapin7 commented Mar 8, 2018

'limit' => 1000 is not good.
The goal is to get around 10,000 RChain Active Members before 10/10/2018.

@dckc
Copy link
Contributor Author

dckc commented Mar 8, 2018

Bingo. I figured out the last of the configuration and permissions issues: had to grant MANAGE_ROLES to my bot.

On March 3 I wrote:

Are we missing an opportunity to store something like the discord user snowflake?

So I fixed that in dckc/rchain-dbr@e1666f7

@dckc
Copy link
Contributor Author

dckc commented Mar 8, 2018

@ian-bloom all that's left is to deploy it in production; we just need you to use your bot management powers to issue us a bot token and then authorize the app on the RChain discord.

I suppose that should wait until we've decided where the PHP+mysql stuff belongs, though.

p.s. I found Grosh's clues useful while I was at it.

@ian-bloom
Copy link
Contributor

@dckc Jeremy is setting up a Co-op hosted Docker container that you can SSH into for setup/maintenance of the PHP app and BOT.

The BOT should not require "change role" permissions. Can it just query if USER_ID has member: role?

In Developer Mode I @mentioned all members to reveal the following ID for the member role <@&ROLE_ID>

\@member:
<@&391679131487698955>

@dckc
Copy link
Contributor Author

dckc commented Mar 9, 2018

The BOT should not require "change role" permissions. Can it just query if USER_ID has member: role?

But the discord API didn't seem to work that way. But looking at it more closely, maybe it does... stay tuned.

@dckc
Copy link
Contributor Author

dckc commented Mar 10, 2018

I think I fixed both the need for MANAGE_ROLES and the 'limit' => 1000 in f66c6a1.

@dckc
Copy link
Contributor Author

dckc commented Mar 12, 2018

@makys I see you added this issue to this week's agenda (#469). I'm interested to know why. Just FYI? What's the goal of the agenda item?

Note that I'm not available to attend the meeting.

@dckc
Copy link
Contributor Author

dckc commented Mar 13, 2018

Thanks to @ian-bloom and @jeremybusk (and @hyperevo earlier) we are live!

For details, see the updated issue description.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development splitting into core-dev, developer-education, ...? (guides: @dckc, ...)
Projects
None yet
Development

No branches or pull requests

6 participants