I’m in the middle of trying to switch everything over to use my OAuth methods, and Discourse is the last thing on my list.
The things would love to complete if it is a feature:
- How would I create public/private user fields to display in their user page about them? Like
Group Rank
for anybody to see, but likeDiscord Id
for only admin and moderators can see (also API)?
Also, how would I implement this in python using Quart? This is some code that I programmed, though the documentation is very unclear on to pass data for Discourse and how too including User Fields, and trying to make them not so users can edit them.
from quart import Quart, redirect, request
from rblxopencloud import OAuth2App, Group
from roblox import RobloxUser
oauth_app = OAuth2App("ROBLOX_APP_ID", "ROBLOX_APP_SECRET", "ROBLOX_APP_REDIRECT")
app = Quart(__name__)
@app.route("/")
async def authentication_verify():
return redirect(oauth_app.generate_uri(["openid", "profile"]))
@app.route("/authentication/redirect")
async def authentication_redirect():
roblox_info = oauth_app.exchange_code(request.args.get('code'))
group_member: Group = RobloxUser.fetch_member(roblox_info.user, 4800717)
group_rank = "Test Subject"
if group_member != None:
group_rank = group_member.fetch_role().name
discord_id = "this-will-pull-from-my-db"
return {
"permalink": roblox_info.user.username,
"username": roblox_info.user.username,
"uri": roblox_info.user.profile_uri,
"avatar_url": roblox_info.user.generate_headshot(size=420, format="jpeg", is_circular=True),
# These I would like to be user fields (either public or private)
"group_rank": group_rank, # Public User Field
"discord_id": discord_id, # Private User Field
"roblox_id": roblox_info.user.id, # Private User Field
}
app.run(host="host-ip-here", port=0000)