Small refactoring on oauth refresh endpoint
This commit is contained in:
parent
ed8b33aaa1
commit
26798df304
@ -15,10 +15,9 @@ import { JWTExpDur } from "../../keys";
|
||||
import RefreshToken from "../../models/refresh_token";
|
||||
|
||||
const RefreshTokenRoute = Stacker(GetClientAuthMiddleware(false, false, true), async (req: Request, res: Response) => {
|
||||
let code = req.query.code || req.body.code;
|
||||
let redirect_uri = req.query.redirect_uri || req.body.redirect_uri;
|
||||
let grant_type = req.query.grant_type || req.body.grant_type;
|
||||
if (!grant_type || grant_type === "authorization_code") {
|
||||
let code = req.query.code || req.body.code;
|
||||
let c = await ClientCode.findOne({ code: code })
|
||||
if (!c) {
|
||||
throw new RequestError(req.__("Invalid code"), HttpStatusCode.BAD_REQUEST);
|
||||
|
Loading…
Reference in New Issue
Block a user