Open bellaabdelouahab opened 1 year ago
@muttaqin1 do you want to take this ?
I havent done github integration before. This will be a big challenge for me.But i will try. @bellaabdelouahab
sure, but it's not that hard the hard part is managing access to certain things like email username repositories and other info. @muttaqin1
I have to use passport.js right? Then when a user log's in i will get a access token and refresh token i will store that in db so that i can do some api request's to Github api?
@bellaabdelouahab
here are some resources https://codevoweb.com/github-oauth-authentication-react-and-node/ @muttaqin1
yeah, I have read the blog. It was beneficial thank you. @bellaabdelouahab
Hello @bellaabdelouahab, Github Oauth doesn't give us access to user password. In that case i am willing to create a model to store github user info and access token. But if we allow null value on the password property in our USER model we can store the data which we will get from github.Then we have to create another model to store access token. So i believe the first option will be great for our use case.What do you think?
Hey @muttaqin1, Yes of course what we need to do is either two ways allow access without password or after connecting to github require the user to enter his password both options are good.
You don't need to create a new model just add the field of github access token to existing userModel
Another thing, Don't store data like repositories or projects... Just the needed data to create a user, About the repos and other info we will make it stateless.
Another thing, Don't store data like repositories or projects... Just the needed data to create a user, About the repos and other info we will make it stateless.
Yeah i know that.
@muttaqin1 any heads-up ?
90% done and now i'm fixing some bugs.I will submit a pr soon. @bellaabdelouahab
I have generated the jwt and set it to the browser using a secured cookie. then redirected to the path which i have got from the req.params.
const {code, path} = req.params
//...some tasks
//... generate jwt
//...set cookie
res.redirect(path);
Is there any other way where we don't have to use the cookie?
like this:
const {code} = req.params
//...some tasks
//... generate jwt
res.status(200).json({
user:createdUser,
token
})
But whenever the callback url is called by github. The server response open's in the browser. Because its a GET request.
@bellaabdelouahab
Can you give me some context like the workflow of github auth so i can understand
@bellaabdelouahab
This issue aims to implement the initial steps for GitHub integration and retrieve repositories this will unlock many possibilities in our application. here are tasks to be done :