/**
  * <p>Returns authorization parameters based on provided options. FitBit 
  * implicit grant flow differs from the generic authorization grant
  * flow in several ways. First, the prompt field is <em>prompt</em> instead of
  * <em>approval_prompt</em>, and the default library will always insert the request
  * field <em>approval_prompt</em>. Second, a scope is required and there is a
  * minimum set of values and a total set of values. If there are any scope
  * errors the API will return an error. Lastly, an <em>expires_in</em> field
  * is required to set the token expiry. The user can override this on the
  * API if the request prompt is set to <em>consent</em></p>
  * 
  * <p><b>Example:</b><br />
  * https://www.fitbit.com/oauth2/authorize?response_type=token&client_id=22942C&redirect_uri=http%3A%2F%2Fexample.com%2Fcallback&scope=activity%20nutrition%20heartrate%20location%20nutrition%20profile%20settings%20sleep%20social%20weight&expires_in=604800
  * </p>
  *
  * @param  array $options
  * @return array Authorization parameters
  * @link https://dev.fitbit.com/docs/oauth2/#authorization-page Authorization
  * @link https://dev.fitbit.com/docs/oauth2/#scope FitBit API Scope
  */
 protected function getAuthorizationParameters(array $options)
 {
     // Check for required scopes
     if (!empty($options['scope']) && count($options['scope']) < count($this->defaultScopes)) {
         throw new InvalidArgumentException("Could not configure provider, missing required scopes");
     }
     // If scopes provided but not all required are provided
     if (count(array_intersect($options['scope'], $this->defaultScopes)) != count($this->defaultScopes)) {
         throw new InvalidArgumentException("Could not configure provider, missing required scopes");
     }
     // Invalid scope provided
     if (count($options['scope']) - count(array_intersect($options['scope'], $this->allScopes)) != 0) {
         throw new InvalidArgumentException("Could not configure provider, invalid scope(s) provided");
     }
     if (empty($options['scope'])) {
         $options['scope'] = $this->defaultScopes;
     }
     $poptions = parent::getAuthorizationParameters($options);
     // option[approval_prompt] needs to be remapped to [prompt]
     unset($poptions['approval_prompt']);
     if (isset($options['prompt'])) {
         $poptions['prompt'] = $options['prompt'];
     }
     // Set the expires query part, if it is not provided, set to 1 day by default
     $poptions['expires_in'] = isset($options['expires_in']) ? $options['expires_in'] : AbstractFitBit::EXPIRES_IN_DAY;
     return $poptions;
 }
 /**
  * <p>Returns authorization parameters based on provided options. FitBit 
  * authorization grant flow differs from the generic authorization grant
  * flow in several ways. First, the prompt field is <em>prompt</em> instead of
  * <em>approval_prompt</em>, and the default library will always insert the request
  * field <em>approval_prompt</em>. Second, a scope is required and there is a
  * minimum set of values and a total set of values. If there are any scope
  * errors the API will return an error.</p>
  * 
  * <p><b>Example:</b><br />
  * https://www.fitbit.com/oauth2/authorize?response_type=code&client_id=22942C&redirect_uri=http%3A%2F%2Fexample.com%2Fcallback&scope=activity%20nutrition%20heartrate%20location%20nutrition%20profile%20settings%20sleep%20social%20weight
  * </p>
  *
  * @param  array $options
  * @return array Authorization parameters
  * @link https://dev.fitbit.com/docs/oauth2/#authorization-page Authorization
  * @link https://dev.fitbit.com/docs/oauth2/#scope FitBit API Scope
  */
 protected function getAuthorizationParameters(array $options)
 {
     // Check for required scopes
     if (!empty($options['scope']) && count($options['scope']) < count($this->defaultScopes)) {
         throw new InvalidArgumentException("Could not configure provider, missing required scopes");
     }
     // If scopes provided but not all required are provided
     if (count(array_intersect($options['scope'], $this->defaultScopes)) != count($this->defaultScopes)) {
         throw new InvalidArgumentException("Could not configure provider, missing required scopes");
     }
     // Invalid scope provided
     if (count($options['scope']) - count(array_intersect($options['scope'], $this->allScopes)) != 0) {
         throw new InvalidArgumentException("Could not configure provider, invalid scope(s) provided");
     }
     if (empty($options['scope'])) {
         $options['scope'] = $this->defaultScopes;
     }
     $poptions = parent::getAuthorizationParameters($options);
     // option[approval_prompt] needs to be remapped to [prompt]
     unset($poptions['approval_prompt']);
     if (isset($options['prompt'])) {
         $poptions['prompt'] = $options['prompt'];
     }
     return $poptions;
 }