Skip to content

Commit

Permalink
refactor: refactor examples to use redirect instead of callback (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
raynerljm authored May 24, 2023
1 parent 504ea3b commit 06385d8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions examples/express/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dotenv.config()

const PORT = 5001
const redirectUri = String(
process.env.SGID_REDIRECT_URI ?? `http://localhost:${PORT}/api/callback`,
process.env.SGID_REDIRECT_URI ?? `http://localhost:${PORT}/api/redirect`,
)
const frontendHost = String(
process.env.SGID_FRONTEND_HOST ?? 'http://localhost:5173',
Expand Down Expand Up @@ -89,7 +89,7 @@ apiRouter.get('/auth-url', (req, res) => {
.json({ url })
})

apiRouter.get('/callback', async (req, res): Promise<void> => {
apiRouter.get('/redirect', async (req, res): Promise<void> => {
const authCode = String(req.query.code)
const state = String(req.query.state)
const sessionId = String(req.cookies[SESSION_COOKIE_NAME])
Expand Down
2 changes: 1 addition & 1 deletion examples/nextjs-csr/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/nextjs-csr/src/lib/sgidClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const sgidClient = new SgidClient({
clientId: String(process.env.SGID_CLIENT_ID),
clientSecret: String(process.env.SGID_CLIENT_SECRET),
privateKey: String(process.env.SGID_PRIVATE_KEY),
redirectUri: 'http://localhost:3000/api/callback',
redirectUri: 'http://localhost:3000/api/redirect',
})

export { sgidClient }

0 comments on commit 06385d8

Please sign in to comment.