"Invalid scope" when requesting OAuth access token

Discussion in '[bd] API' started by Morhaus, May 18, 2014.

  1. Morhaus

    Morhaus New Member

    #1 , May 18, 2014
    Last edited: May 18, 2014
    Hey.

    I'm trying to use oauth authentication on an external website using NodeJS with passport-oauth2. When passport-oauth2 requests an access token, the forum returns

    Code:
    { statusCode: 400, data: '{"error":"invalid_scope"}' }
    Here are the details of the request :
    URL:
    Code:
    http://[forum address]/api/oauth/token
    Headers:
    Code:
    { 'Content-Type': 'application/x-www-form-urlencoded' }
    POST params:
    Code:
    grant_type=authorization_code&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fauth%2Fxenforo%2Fcallback&client_id=[consumer key]&client_secret=[consumer secret]&code=490c237772e559cfe311771b2c3dc03b
     
  2. xfrocks

    xfrocks XenForo rocks!
    Staff Member

    You must include the scope that matches the authorization request.
     
  3. Morhaus

    Morhaus New Member

    Thanks! It works.
     
  4. xfrocks

    xfrocks XenForo rocks!
    Staff Member

Loading...