mirror of
https://github.com/xHyroM/roles-bot.git
synced 2024-11-23 16:51:06 +01:00
Compare commits
2 commits
164bc09cdd
...
8eca9f1ec5
Author | SHA1 | Date | |
---|---|---|---|
8eca9f1ec5 | |||
0cdb41abb7 |
2 changed files with 16 additions and 0 deletions
|
@ -50,6 +50,20 @@ export async function GET(context: APIContext): Promise<Response> {
|
||||||
sessionCookie.value,
|
sessionCookie.value,
|
||||||
sessionCookie.attributes
|
sessionCookie.attributes
|
||||||
);
|
);
|
||||||
|
|
||||||
|
await context.locals.runtime.env.DB.prepare(
|
||||||
|
"UPDATE user SET username = ?2, avatar = ?3, access_token = ?4,access_token_expiration = ?5, refresh_token = ?6 WHERE discord_id = ?1"
|
||||||
|
)
|
||||||
|
.bind(
|
||||||
|
discordUser.id,
|
||||||
|
discordUser.username,
|
||||||
|
discordUser.avatar,
|
||||||
|
tokens.accessToken,
|
||||||
|
tokens.accessTokenExpiresAt.getTime(),
|
||||||
|
tokens.refreshToken
|
||||||
|
)
|
||||||
|
.first<UserRow>();
|
||||||
|
|
||||||
return context.redirect("/dashboard");
|
return context.redirect("/dashboard");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,8 @@ export async function GET(context: APIContext): Promise<Response> {
|
||||||
scopes: ["identify", "guilds"],
|
scopes: ["identify", "guilds"],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log("login");
|
||||||
|
|
||||||
context.cookies.set("discord_oauth_state", state, {
|
context.cookies.set("discord_oauth_state", state, {
|
||||||
path: "/",
|
path: "/",
|
||||||
secure: import.meta.env.PROD,
|
secure: import.meta.env.PROD,
|
||||||
|
|
Loading…
Reference in a new issue