title: Laravel 5.1 oAuth 2 server 'invalid scope' error
body: <p>I'm using <a href="https://github.com/lucadegasperi/oauth2-server-laravel" rel="nofollow">oauth2-server-laravel</a> for my API. I want to give scopes to clients app who are using my API (Android, Windows,IOS and web). Therefore I implemented following way.</p>
  
  <p>my table data as follows</p>
  
  <p><strong>oauth_clients</strong> Table</p>
  
  <blockquote>
    <p>+-----------+---------+---------+---------------------+---------------------+<br>
    | id| secret  | name    | created_at          | updated_at          |<br>
    +-----------+---------+---------+---------------------+---------------------+<br>
    | 123456789 | secret1 | web     | 2015-08-10 00:00:00 | 2015-08-10 00:00:00 |<br>
    | 234567890 | secret2 | win_app | 2015-08-10 00:00:00 | 2015-08-10 00:00:00 |<br>
    +-----------+---------+---------+---------------------+---------------------+</p>
  </blockquote>
  
  <p><strong>oauth_scopes</strong> Table</p>
  
  <blockquote>
    <p>+--------+--------------------+---------------------+---------------------+<br>
    | id     | description        | created_at          | updated_at          |<br>
    +--------+--------------------+---------------------+---------------------+<br>
    | scope1 | guest level access | 2015-08-10 00:00:00 | 2015-08-10 00:00:00 |<br>
    | scope2 | admin level access | 2015-08-10 00:00:00 | 2015-08-10 00:00:00 |<br>
    +--------+--------------------+---------------------+---------------------+</p>
  </blockquote>
  
  <p><strong>oauth_client_scopes</strong> Table</p>
  
  <blockquote>
    <p>+----+-----------+----------+---------------------+---------------------+<br>
    | id | client_id | scope_id | created_at          | updated_at          |<br>
    +----+-----------+----------+---------------------+---------------------+<br>
    |  1 | 234567890 | scope2   | 2015-08-10 00:00:00 | 2015-08-10 00:00:00 |<br>
    |  2 | 123456789 | scope1   | 2015-08-10 00:00:00 | 2015-08-10 00:00:00 |<br>
    +----+-----------+----------+---------------------+---------------------+</p>
  </blockquote>
  
  <p>My <strong>routes.php</strong>,</p>
  
  <pre><code>Route::group(['middleware' =&gt; 'oauth:scope2','prefix' =&gt; 'api/v1'], function () {
             Route::GET('categoriesWithOffers', 'api\v1\CategoriesController@categoriesWithOffers');  
  });
  </code></pre>
  
  <p>and my <strong>oauth2.php</strong> settings as below</p>
  
  <pre><code>'grant_types' =&gt; [
      'client_credentials' =&gt; [
          'class' =&gt; '\League\OAuth2\Server\Grant\ClientCredentialsGrant',
          'access_token_ttl' =&gt; 3600
      ],
  ],
  'token_type' =&gt; 'League\OAuth2\Server\TokenType\Bearer',
  'state_param' =&gt; false,
  'scope_param' =&gt; false,
  'scope_delimiter' =&gt; ',',
  'default_scope' =&gt; null,
  'limit_clients_to_grants' =&gt; false,
  'limit_clients_to_scopes' =&gt; false,
  'limit_scopes_to_grants' =&gt; false,
  'http_headers_only' =&gt; false,
  </code></pre>
  
  <p>I requested following way</p>
  
  <pre>http://domain.com/api/v1/categoriesWithOffers?access token=Jo7lAqE2uD3KbyLQWlrmukzyHJOQBHZ1QFsuBKUt&scope=scope1</pre>
  
  <p>and it gives me this error</p>
  
  <blockquote>
    <p>{
      "error": "invalid_scope",
      "error_description": "The requested scope is invalid, unknown, or malformed. Check the \"scope2\" scope."
    }</p>
  </blockquote>
  
  <p>When I added current request token and scope to the 
  <strong>oauth_access_token_scopes</strong> table it works fine.But I need to define scopes as mentioned at the bigining of this question.</p>
  
  <p>Any help would be greatly appreciated!</p>