Closed ghost closed 4 years ago
The endpoint to get user information is here, it is currently undocumented but it is accessible with an access token that has the "public" scope.
In order to actually make a request to that endpoint and not get back that "authentication basic" message, you will need to register an OAuth application (as described here) and go through the OAuth2 authorization flow to get an access token that you can add to the header of your request (documented directly below that previous link).
You can read up more on OAuth2 here and there are many more resources on Google that you can use as well. Specifically, you'll probably want to look into the "Authorization Code" or "Client Credentials" grant types, since registering an application and actually making requests once you have an access token is pretty straightforward.
Going to bump this to milestone under missing documentation.
Thanks, but what if I don't have the user's id and username and I'd like to get it ?
That /users endpoint seems to accept either a username or user id in place of the {user} part of the url. The response will contain the user id regardless of which is used.
One thing to note though is that IDs are prioritized in the lookup. Meaning if someone has a name that is all numbers that happens to be someone's user ID, querying with that will return the information for the person with that ID and not the person with the name. So it's slightly "dangerous" to use that endpoint with names in an actual app.
I understand. But is there any way to get the username or user id of the person who authenticated with oauth2?..
It's /api/v2/me
to get user of the token.
The docs can use more details but should be enough for now.
Also I don't know where the original reporter get the idea of https://osu.ppy.sh/api/v2/UserCompact
url.
Hello,
I was wondering how I could get some info from the user with the API v2 of osu,
All I see in this link is a "TODO: This >.>" since months (https://osu.ppy.sh/docs/index.html#user)
Even the UserCompact endpoint doesn't work, all I get as response of my curl request is an " [authentication] => basic" I'm using these urls so it is supposed work according to the API docs : https://osu.ppy.sh/api/v2/User and https://osu.ppy.sh/api/v2/UserCompact
Cordially