Skip to content

Commit

Permalink
Merge pull request #74 from ASparton/front
Browse files Browse the repository at this point in the history
fix(auth): 🐛 github oauth
  • Loading branch information
iittooss authored Jan 8, 2024
2 parents d81e915 + 4fdb38d commit a05406e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion back/src/controllers/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,21 @@ controller.get("/github/callback", async (req, res) => {
};

const user = await getUser();
auth.createSession({
const session = await auth.createSession({
userId: user.userId,
attributes: {},
});

return res.status(HttpStatusCode.OK_200).send({
user: {
id: user.userId,
email: user.email,
username: user.username,
currency: user.currency,
is_admin: user.is_admin,
},
token: session.sessionId,
});
} catch (e) {
if (e instanceof OAuthRequestError) {
// invalid code
Expand Down

0 comments on commit a05406e

Please sign in to comment.