Hiding Credentials

You can hide passwords, API Keys, etc in an external include file as shown by the examples that follow.  

hidden_credentials.ino


/*
  Hiding credentials (passwords, API keys, etc) in an external
  file that is included.
 
*/

/////////////////////////////////////////////////////////////////////////

#include "credentials.h"

HiddenCredentials myBlynkCredentials = HiddenCredentials();

// Note:
//  #include "credentials.h" causes complier to look for files in the local directory first
//  #include  causes compiler to look only in the compiler's include directory search path.

/////////////////////////////////////////////////////////////////////////


void setup() {

  Serial.begin(115200);
  while (!Serial) {
    delay(1);
  }
  Serial.println("\nSerial ready");

  String blynk_auth_token = myBlynkCredentials.getBlynkAuthToken();
  Serial.print("BLYNK_AUTH_TOKEN: '");
  Serial.print(blynk_auth_token);
  Serial.println("'");

  Serial.println("Setup finished");
} // setup()


void loop() {

} // loop()

credentials.h


#include "credentials.h"

/************  Constructor ************/

HiddenCredentials::HiddenCredentials(){
  
}

/**********  Public Functions **********/

String HiddenCredentials::getBlynkAuthToken() {
  return "your_32_character_blynk_auth_token";
}

credentials.cpp



#ifndef HIDDEN_CREDENTIALS_LIB_H_
#define HIDDEN_CREDENTIALS_LIB_H_

#include 

class HiddenCredentials {
  public:
    HiddenCredentials();  // Constructor
    
    String getBlynkAuthToken();

  // Note that: 
  //  #define BLYNK_AUTH_TOKEN "your_32_char_token"
  // defines 'BLYNK_AUTH_TOKEN' as a String.
  
};

#endif