Skip to content

Conversation

@non
Copy link
Collaborator

@non non commented Oct 7, 2017

This isn't working yet, for at least two reasons:

  1. I'm not sure where a secure place to put client_secret is.
  2. I'm not sure how to save/pass an access_token in vue.

However, I read a bit about Axios and I think these are the right
POST requests we want to be making.

This isn't working yet, for at least two reasons:

  1. I'm not sure where a secure place to put client_secret is.
  2. I'm not sure how to save/pass an access_token in vue.

However, I read a bit about Axios and I *think* these are the right
POST requests we want to be making.
@deconstructionalism
Copy link
Collaborator

deconstructionalism commented Mar 19, 2019

@non here are some ideas ...

  1. you can put the client_secret/api_key etc in a .env file on the host server, put .env in .gitignore, and use something like the dotenv package to load the values into the server from the file. Lastly, you'd want to adjust the .httaccess file such that .env is explicitly forbidden from being accessed from the client-side. the hardcore-ass way is to store the secret data in a (possibly ephemeral) database with restricted access, but this is for crazy people / people who are scared.

  2. as far as where to store the token in Vue, you need to store the token data at the closest parent component shared by all child components that consume the token. Or in simpler terms, just put it all the way in the root component, and pass it down as a prop to the children who need it. You should also declare a method in the root component for getting the token using axios and saving it in state, and pass the method down to child components that may need to trigger "get token". That way, the method also is scoped to the root component and can save the token in the root component state after receiving it, no matter which child component calls the "get token" method.

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.

3 participants