github_auth presque integre (implementation pas finis)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const authService = require('../services/auth');
|
||||
const fetch = require('node-fetch');
|
||||
|
||||
router.post('/register', async(req, res) =>
|
||||
{
|
||||
@@ -20,4 +21,13 @@ router.post('/login', async(req, res) =>
|
||||
res.status(result.status).json(result.data);
|
||||
});
|
||||
|
||||
router.get('/github', (req, res) => {
|
||||
const githubAuthUrl = `https://github.com/login/oauth/authorize?` +
|
||||
`client_id=${process.env.GITHUB_CLIENT_ID}&` +
|
||||
`redirect_uri=${encodeURIComponent(process.env.GITHUB_REDIRECT_URI)}&` +
|
||||
`scope=user:email`;
|
||||
|
||||
res.redirect(githubAuthUrl);
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
Reference in New Issue
Block a user