avant
avant
Explore posts from servers
DIAdiscord.js - Imagine an app
Created by avant on 9/20/2024 in #djs-questions
Discord OpenID != Google OpenID?
I KNOW I CAN USE ACCESS_TOKEN, this is specifically about openid (parentheses mean "or", profile or email) Google Scopes: openid, userinfo.profile (userinfo.email) Code exchange response: access_token, id_token, etc id_token: has name (email) Discord Scopes: openid, identify (email) Code exchange response: access_token, id_token, etc id_token: does not have name (email) My fault? Just how discord openid works?
const data = await fetch("https://discord.com/api/oauth2/token", {
method: "POST",
headers: {
"content-type": "application/x-www-form-urlencoded",
},
body: new URLSearchParams({
client_id: id,
client_secret: process.env.DC_SECRET || "",
redirect_uri: "http://localhost:3000",
scope: "openid identify",
code: code,
grant_type: "authorization_code",
}).toString(),
});
const data = await fetch("https://discord.com/api/oauth2/token", {
method: "POST",
headers: {
"content-type": "application/x-www-form-urlencoded",
},
body: new URLSearchParams({
client_id: id,
client_secret: process.env.DC_SECRET || "",
redirect_uri: "http://localhost:3000",
scope: "openid identify",
code: code,
grant_type: "authorization_code",
}).toString(),
});
4 replies