Skip to content

Added oAuth by Github #25

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

Merged
merged 1 commit into from
Dec 9, 2019
Merged

Conversation

txrp0x9
Copy link
Contributor

@txrp0x9 txrp0x9 commented Dec 6, 2019

ABOUT

Made a few changes to Login.vue so that the access token is retrieved from github.
Resolves #15


TESTING

  • Create an oAuth application if you haven't already
  • Makes sure that the callback-url is set to http://localhost:8080/#/auth
  • Make an .env file in the root folder of the project (where package.json is)
  • Add the code given below and replace it with values from your oAuth application:
    VUE_APP_CLIENT_ID=<client id>
    VUE_APP_CLIENT_SECRET=<client secret>
  • Run the app using npm start serve
  • Test!

@ayushnagar123
Copy link
Member

HI @TORPEDO99 I worked on your pull request please update the pull request as follows:-

  • to remove cors error:-
    the present code redirects to a hosted link as we can see in the vue.config.js that if it is in production mode it changes the publicPath to /Codebadge. We don't need to do that as we are not redirecting it to that host link. and in your devServer object set https as true. This will run your localhost with https protocol.
    Note:- your vue.config.js must be in your root folder of project i.e. where your package.json is.
  • your callback url needs to be updated in your GitHub OAuth.
    Note:- redirect url must also be of https protocol.
  • update homeUrl from http to https in axiosHelper.js.
    After you solve all these issues you will observe that after OAuth gets submitted, your url directes with https://localhost:8080/?code=..../#/home/ this will ultimately redirect to some other link. You will need to solve the issue.

@ayushnagar123
Copy link
Member

headers: { "Access-Control-Allow-Origin": "*" }
@TORPEDO99 add this to your in your vue.config.js in your devServer object and let me know is there any changes or not with the issue you are facing.

@txrp0x9
Copy link
Contributor Author

txrp0x9 commented Dec 8, 2019

Integrated a simple method to extract the access_token from the response and store it locally to be used for further authorized github api calls.

@txrp0x9
Copy link
Contributor Author

txrp0x9 commented Dec 8, 2019

Switched to using environment variables instead of saving client secret and id in a file.
Read the PR details for testing procedure.

Copy link
Member

@ayushnagar123 ayushnagar123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done.

Copy link
Collaborator

@shivamluthra shivamluthra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me 👍 Please squash all the commits to one with all the commit messages under it @TORPEDO99

Added requested changes

Changed oauth credentials

Added a third party proxy to bypass cors errors

Added access token extractor

switched to environment variables

Delete .env.local

Added setup steps in readme
@shivamluthra shivamluthra merged commit 8586200 into codeuino:master Dec 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

User Authentication via GitHub
3 participants