2015-06-02 35 views
0

我想在整個應用程序中根據需要遞增地請求範圍。oauth-4-laravel的動態範圍

例如,在登錄時,我可能只需要電子郵件和配置文件。

'consumers' => array(
     'Google' => array(
      'client_id'  => 'clientid.apps.googleusercontent.com', 
      'client_secret' => 'clientsecret', 
      'scope'   => array('email', 'profile'), 
     ) 
    ) 

在我的應用程序之後,如果用戶想要管理自己的聯繫人列表,我可能會想請求的範圍爲:

'Google' => array(
       'client_id'  => 'clientid.apps.googleusercontent.com', 
       'client_secret' => 'clientsecret', 
       'scope'   => array('https://www.google.com/m8/feeds/'), 
      ) 

有一種優雅的Laravel的方式來實現,而不設置以下/在這個配置文件的開頭檢查一個標誌變量?

回答

1

通用的方法來設置Laravel-4的配置文件是

Config::set('key', value); 

對於以上這並獲得成功:

Config::set('oauth-4-laravel.consumers.Google.scope', ['https://www.google.com/m8/feeds/']);