A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.ory.sh/hydra/ below:

The cloud native OAuth 2.0 and OpenID Connect server

const express = require('express');
const app = express();

const { AuthorizationCode } = require("simple-oauth2")

const client = new AuthorizationCode({
  client: {
    id: process.env.CLIENT_ID,
    secret: process.env.CLIENT_SECRET,
  },
  auth: {
    tokenHost: "https://<your-project>.projects.oryapis.com",
    tokenPath: "/oauth2/token",
    authorizePath: "/oauth2/auth",
  },
})

app.get("/", (req, res) => {
  const authorizationUri = client.authorizeURL({
    redirect_uri: REDIRECT_URI,
    scope: "openid offline",
  })

  res.redirect(authorizationUri)
})

app.get("/callback", async (req, res) => {
  const { code } = req.query

  try {
    const accessToken = await client.getToken({
      code,
      redirect_uri: process.env.REDIRECT_URI,
      scope: "openid offline",
    })

    res.json(accessToken.token)
  } catch (error) {
    res.status(500).json({ error: error.message })
  }
})

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4