Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auth with GitHub using nuxt auth module #48

Open
lukeocodes opened this issue Oct 15, 2020 · 8 comments · May be fixed by #132
Open

auth with GitHub using nuxt auth module #48

lukeocodes opened this issue Oct 15, 2020 · 8 comments · May be fixed by #132
Assignees
Labels
enhancement New feature or request hacktoberfest help wanted Extra attention is needed

Comments

@lukeocodes
Copy link
Owner

lukeocodes commented Oct 15, 2020

Editing with info for anyone who wants to help with this one.

There are a few ways to connect to GitHub APIs.

One is using a static personal access token (mine), which is stored as an environment variable and deployed to the Netlify Function (AWS Lambda function) that connects to GitHub.

Another way is to have a user of the site "Login with GitHub", they then get an Acess Token which can be stored in the memory of the frontend application (not in cookies or local storage), then sent through to the Netlify Function whenever they make a request. Not only for this purpose, but it also will provide the users GitHub profile information, to enrich the experience on the site (i.e. they could track their entire Hacktoberfest progress).

There are packages like nuxt-auth that will make some of this work easier, but from my own experimentation, those packages offered incomplete solutions. I believe I was closest with nuxt-auth, which appeared to be using an auth code grant, but I should have created a new Netlify Function to act as the backend to exchange the authorization code for an access token.

GitHub has some guides on building an OAuth application.

@lukeocodes lukeocodes self-assigned this Oct 15, 2020
@lukeocodes lukeocodes added enhancement New feature or request hacktoberfest labels Oct 15, 2020
@git-srinivas
Copy link

git-srinivas commented Oct 17, 2020

I would like to pick this one @lukeocodes Could you provide more info on this?

@lukeocodes
Copy link
Owner Author

@git-srinivas I would like to be able to log in to GitHub from the Nuxt application, hopefully without the need for a backend. If you need a backend, please create a Netlify function to act as the backend.

@git-srinivas
Copy link

okay and also i need to create a form for user credentials?

@lukeocodes
Copy link
Owner Author

No, you should use GitHub OAuth2 workflow

@git-srinivas
Copy link

okay.

@git-srinivas
Copy link

git-srinivas commented Oct 20, 2020

@git-srinivas I would like to be able to log in to GitHub from the Nuxt application, hopefully without the need for a backend. If you need a backend, please create a Netlify function to act as the backend.

I could see that we are already authenticated with github personal access token and able to get repositories information. You mean to provide login functionality to the website visiting user?

@lukeocodes
Copy link
Owner Author

Hi and yes. I should have updated the issue when you first showed interest, sorry for the lack of info.

There are a few ways to connect to GitHub APIs.

One is using a static personal access token (mine), which is stored as an environment variable and deployed to the Netlify Function (AWS Lambda function) that connects to GitHub.

Another way is to have a user of the site "Login with GitHub", they then get an Acess Token which can be stored in the memory of the frontend application (not in cookies or local storage), then sent through to the Netlify Function whenever they make a request. Not only for this purpose, but it also will provide the users GitHub profile information, to enrich the experience on the site (i.e. they could track their entire Hacktoberfest progress).

There are packages like nuxt-auth that will make some of this work easier, but from my own experimentation, those packages offered incomplete solutions. I believe I was closest with nuxt-auth, which appeared to be using an auth code grant, but I should have created a new Netlify Function to act as the backend to exchange the authorization code for an access token.

GitHub has some guides on building an OAuth application.

@git-srinivas
Copy link

No worries. I will go through the documentation and thanks for the info 👍

@lukeocodes lukeocodes added help wanted Extra attention is needed up for grabs and removed up for grabs labels Oct 24, 2020
@git-srinivas git-srinivas linked a pull request Oct 30, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants