ppy / osu-web

the browser-facing portion of osu!
https://osu.ppy.sh
GNU Affero General Public License v3.0
970 stars 381 forks source link

osu-web api /users/{id}/beatmapsets/{status} returns 403 #8136

Closed Sebola3461 closed 2 years ago

Sebola3461 commented 3 years ago

My request code:

get("https://osu.ppy.sh/api/v2/users/{user_id}/beatmapsets/ranked", {
        headers: {
            "Content-Type": "application/json",
            "Accept": "application/json",
            "Authorization": `Bearer ${auth_token}` // OAuth "auth_token"
        }
    }).then(response => { return response.json() }).catch(e => {
        res.send(e)
})

response:

{
  "message": "Request failed with status code 403",
  "name": "Error"
 }
tybug commented 3 years ago

Are you sure your auth token is valid? If you are using the client credentials grant and generated this token more than 24 hours ago, it will be expired and invalid and you will need to generate a new one.

Sebola3461 commented 3 years ago

Yes, the token is valid. If not, the response code would be 401.

request with invalid token: image

tybug commented 3 years ago

right - did you make sure to request the public scope when authenticating? That endpoint needs the public scope.

Sebola3461 commented 3 years ago

yes. image

nanaya commented 3 years ago

what's the error message?

Sebola3461 commented 3 years ago

what's the error message?

https://github.com/ppy/osu-web/issues/8136#issue-1000141227

ilsubyeega commented 3 years ago

Yes, the token is valid. If not, the response code would be 401.

request with invalid token: image

if the token is wrong the response seems to be like this with 401 code:

{
  "authentication": "basic"
}

I'm guessing the response from your web server is the exception?

nanaya commented 3 years ago

what's the error message?

#8136 (comment)

As mentioned above, that's not the response returned by osu-web. Please check the original response.

Sebola3461 commented 2 years ago

I generated the token again and this time it worked, I have no idea why. Because the previous token had just been generated.