dgrubelic / vue-authenticate

Simple Vue.js authentication library
1.43k stars 252 forks source link

Custom Provider Example #166

Open adrian549092 opened 5 years ago

adrian549092 commented 5 years ago

Hi everyone, web development in general is a completely new area for me not to mention VUE JS, JavaScript, and OAuth, so needless to say I am having a bit of a hard time getting everything working right, would really appreciate it if I could get some guidance on how to achieve my goal.

Thank you in advance for your time, and my apologies for the length of the post.

App Authentication Flow:

Implementing the OAuth2 provider added in #21

VUE Components:

Question:

  1. What is the purpose of the baseURL attribute? Would the baseURL be the URL for my front end app: http://localhost, or the url for my backend app: http://localhost:8080?
  2. What is the purpose of the url attribute?
  3. Should I be handling the submitting of the GraphQL call from the OauthAuthorized.vue component, or should it be from within the this.$auth.authenticate(provider) call?
    • I have gotten to a point where I get all the way to the OauthAuthorized.vue component and I see the page rendered for the component, but it never reaches the inner code block of the this.$auth.authenticate(provider) call where I call console.log('TEST TEST');
dgrubelic commented 5 years ago
  1. baseUrl is the url of your backend.
  2. url prop in provider config is the url where initial request to start auth will be sent.
  3. You should be using this.$auth.authenticate(provider) since entire flow is implemented in vue-authenticate library and you shouldn't be doing any code -> token exchange on your own. Hope got what you are doing correctly.