Deno js with auth2.0 auth procsess

65 Views Asked by At

I am trying to import oauth2.0 using Deno + fresh. I can import it, but when using social login or e-mail login, I cannot receive data from the URL where Auth2.0 returns user data to me, it returns short empty data even though I am logged in.

I use oauth 2.0 with the oauth2_client package in deno js.

export const handler: Handlers<User | null> = {
  async GET(req, ctx) {
    const session = await getSessionId(req);

    if (!session) {
      return new Response("Giriş yap");
    }
    const acsess = await getSessionAccessToken(oauth2Client, session);
    const data = await fetch(
      "https://mango-auth.eu.auth0.com/userinfo",
      {
        headers: {
          Authorization: `bearer ${acsess}`,
        },
      },
    );
    const a = await data.json();
    console.log(a);
    return ctx.render(a);
  },
};
0

There are 0 best solutions below