Twitter API calls in Vue

I got my twitter dev account set up and my API key, secret key and bearer token.

How do I treat these API keys and where do I put them? Somehow that’s the one thing I can’t find any guides or documentation on. In a separate file? Where do I route them? I’m confused. (doesn’t take much, I’ll admit)

The API keys should be in a separate file and protected. Anyone gaining access to your API keys will be able to use them to make API calls, putting your account in danger.
Usually there’s a .env file where you would put those and refer to them using something like process.enc.TWITTER_API_KEY

Here’s a npm package that helps you with that if you are using node:

1 Like

So put this .env file it in a MD5 folder perhaps?

I don’t get the process.enc.TWITTER_API_KEY?
Do I put a tag with a URL in the .js file containing the API calls?
(Think of me as a newbie and then add infant with a splash of retard)

No, the .env file is (typically) placed in the root folder of the project. This is the case when using Vue CLI. You access the variables in the env file within your project by using process.env.VUE_APP_MYENVVAR

For more information:

sorry, I had a typo. it’s supposed to be .env., not .enc.
Please look at the link referred by @JamesThomson

Here is a good implementation example using js, in the same repo you can find more examples written in other languages.

Hope it helps