acmutd / acmutd/portal

[Feature Request] Allow a user to connect their Discord account to their Portal account

未關閉
#61 3 則留言 0 個 reaction 已指派 1 人 已被 @trexrush 認領 在 GitHub 檢視
New Feature
主要語言
TypeScript
星號
2
分支
0
PR 合併指標
30 天內沒有已合併 PR

描述

# Overview
Set up the groundwork for future discord integration features. This groundwork includes grabbing user metadata, such as snowflake, username, and discriminator, from discord,

A user must first connect a Discord account. On each sign-in afterward, we need to fetch the user's metadata from Discord including their snowflake. This is done by using the access token in the accounts collection to send an api call to Discord.
# Tasks
- [x] Add Discord Auth URL with identify, email, guilds scope to NextAuth Discord provider options
- [ ] Get user metadata from Discord, including snowflake, username, discriminator
- [ ] [Verify user is in acm server](https://github.com/acmutd/portal-backend/blob/b596d0f2caa2db947df7b78182296c8f0b246c9a/functions/src/admin/discord.ts#L25)
- [ ] [Add verified role](https://github.com/acmutd/portal-backend/blob/b596d0f2caa2db947df7b78182296c8f0b246c9a/functions/src/admin/discord.ts#L84)
- [ ] Document

# Supplemental Information
* [NextAuth Discord Provider Options Docs](https://next-auth.js.org/providers/discord)
* [portal v1 getting user metadata](https://github.com/acmutd/portal-backend/blob/b596d0f2caa2db947df7b78182296c8f0b246c9a/functions/src/admin/auth0.ts#L51)
* [portal v1 discord features](https://github.com/acmutd/portal-backend/blob/dev/functions/src/admin/discord.ts)

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

Review `functions/src/admin/discord.ts` and the linked `functions/src/admin/auth0.ts` first; they show existing metadata and role patterns. Then find the NextAuth Discord provider configuration in the auth flow and update scope options (identify, email, guilds), and trace where access tokens are stored so each sign-in can call Discord for `snowflake`, `username`, and `discriminator`. Run or replay the sign-in path through that auth entry point to validate token use end to end. Done when each login fetches metadata, checks ACM guild membership, applies the verified role via `discord.ts`, and updates docs.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
node.js, typescript
領域
authentication
Issue 類型
功能
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
34/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。