diff --git a/README.md b/README.md index 5fcfcd1..bbb26c1 100644 --- a/README.md +++ b/README.md @@ -20,4 +20,11 @@ https://example.vercel.app/authorize?port=4200 https://localhost:4200/{CALLBACK_URL}?access_token={access_token}&refresh_token={refresh_token}&expires_in={expires_in} 7. profit? +To resfresh the token request this +POST: +https://example.vercel.app/refresh?port=4200 +body: refresh_token : {refreshtoken} + +new token should be send like in 6 + ## use at own risk, security holes might be in there diff --git a/server.js b/server.js index 9e52912..4d9d7d0 100644 --- a/server.js +++ b/server.js @@ -35,7 +35,7 @@ app.get('/refresh', (req, res) => { const refresh_token = req.body.refresh_token; const callbackport = req.query.port; - + if(callbackport != null){ try { @@ -60,7 +60,7 @@ app.get('/refresh', (req, res) => { console.log(data) res.redirect(`http://localhost:${callbackport}/${process.env.CALLBACK_URL}?access_token=${data.access_token}&refresh_token=${data.refresh_token}&expires_in=${data.expires_in}`); }) - .catch(error => console.error('Error:', error)); + .catch(error => res.json(error)); } catch (error) { console.error(error);