Facebook account email for login (optional if already logged in once)
Facebook account password for login (optional if already logged in once)
Memcachier password (from dashboard or Heroku) for storage
Memcachier servers (from dashboard or Heroku) for storage
Memcachier username (from dashboard or Heroku) for storage
Generated using TypeDoc
Logging into BotCore
The
LoginCredentials
object is required for logging in to any application using BotCore. The idea of it is to store your (sensitive) credentials separately from the source of your project, in a place that won't be accidentally committed to a repo and published for the world to see. It consists of several required keys that allow BotCore to log in to both Facebook and the MemCachier service (used to cache logins) on your behalf. The keys are listed and explained below.I recommend the following two methods for storing your credentials object due to their ease of use:
Environment variables: you can store these keys as environment variables, which will prevent them from being stored in any file in your project. When logging in, simply pass
process.env
as your credentials object, because it will contain all of the required keys needed to log in successfully! You can find an example of how to configure your credentials this way inexamples/credentials.sh
in the BotCore repo.A gitignored credentials file: you can create a file (
credentials.js
or similar) that contains all of your required credentials keys as exported variables, and then simply import this as a JS module wherever you need to log in. Don't forget to add this credentials file to your.gitignore
so that your credentials aren't exposed! You can find an example of how to configure your credentials this way inexamples/credentials.js
in the BotCore repo.These are two of many possible ways you could choose to store this information. Keep in mind that regardless of which method you choose, you will have to eventually pass a JavaScript object containing the following keys to the login function, so you will need to be able to access this information at runtime.
Also keep in mind that the
FACEBOOK_EMAIL
andFACEBOOK_PASSWORD
keys are only required for login if you do not have an active Facebook login session stored in BotCore (i.e. you have logged in recently, and Facebook hasn't decided to terminate your session yet). BotCore caches your recent logins to prevent too many hard (username/password) logins, unless you use theforceLogin
option. If you are using several bots with BotCore, consider storing yourFACEBOOK_EMAIL
andFACEBOOK_PASSWORD
keys with only one of them, and only using yourMEMCACHIER_
variables to log in from other bots.