Skip to content

Commit 7535c17

Browse files
authored
Users reported that the access token validation endpoint was always failing. (#209)
1 parent 35fdbf1 commit 7535c17

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

routes/client.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import express from 'express'
22
const router = express.Router()
33
import auth from '../auth/index.js'
4+
import { getAgentClaim } from '../controllers/utils.js'
45

56
router.get('/register', (req, res, next) => {
67
//Register means register with the RERUM Server Auth0 client and get a new code for a refresh token.
@@ -18,6 +19,13 @@ router.get('/register', (req, res, next) => {
1819

1920
router.post('/request-new-access-token',auth.generateNewAccessToken)
2021
router.post('/request-new-refresh-token',auth.generateNewRefreshToken)
21-
router.get('/verify',auth.checkJwt)
22+
23+
// Verifies good tokens are from RERUM. Fails with 401 on tokens from other platforms, or bad tokens in genreal.
24+
router.get('/verify', auth.checkJwt, (req, res, next) => {
25+
const generatorAgent = getAgentClaim(req, next)
26+
res.set("Content-Type", "text/plain")
27+
res.status(200)
28+
res.send("The token was verified by Auth0")
29+
})
2230

2331
export default router

0 commit comments

Comments
 (0)