🔒 Add validation for Challonge OAuth configuration in token and refresh endpoints
This commit is contained in:
@@ -54,6 +54,13 @@ app.use('/api/gamemaster', gamemasterRouter);
|
||||
* POST /oauth/token
|
||||
*/
|
||||
app.post('/oauth/token', async (req, res) => {
|
||||
if (!hasChallongeAuth) {
|
||||
return res.status(503).json({
|
||||
error: 'Challonge OAuth not configured',
|
||||
message: 'Set CHALLONGE_CLIENT_ID and CHALLONGE_CLIENT_SECRET environment variables'
|
||||
});
|
||||
}
|
||||
|
||||
const { code } = req.body;
|
||||
|
||||
if (!code) {
|
||||
@@ -98,6 +105,13 @@ app.post('/oauth/token', async (req, res) => {
|
||||
* POST /oauth/refresh
|
||||
*/
|
||||
app.post('/oauth/refresh', async (req, res) => {
|
||||
if (!hasChallongeAuth) {
|
||||
return res.status(503).json({
|
||||
error: 'Challonge OAuth not configured',
|
||||
message: 'Set CHALLONGE_CLIENT_ID and CHALLONGE_CLIENT_SECRET environment variables'
|
||||
});
|
||||
}
|
||||
|
||||
const { refresh_token } = req.body;
|
||||
|
||||
if (!refresh_token) {
|
||||
|
||||
Reference in New Issue
Block a user