Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save topher1kenobe/119956fdea2f2cadf36f767f77dd86c7 to your computer and use it in GitHub Desktop.
Save topher1kenobe/119956fdea2f2cadf36f767f77dd86c7 to your computer and use it in GitHub Desktop.
/*
* Get the auth token from local option
*
* @access public
* @return NULL
*/
public function get_local_auth_token() {
// get the token from the options table
$this->auth_token = get_option( 'bigcommerce_auth_token' );
// if the local copy is empty, go get one from BigCommerce
if ( empty( $this->auth_token ) ) {
// get the token
$token = $this->get_remote_auth_token();
// set the local copy for next time
update_option( 'bigcommerce_auth_token', $token );
// set the token for this instance
$this->auth_token = $token;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment