Hello.
I make personal iOS app for editing Openstreetmap. I want log in with oAuth 2.0
My user go to auth page /oauth2/authorize
Enter login and pass, and after redirect i have code=CODE
Than i need send secret_key and this code to url https://www.openstreetmap.org/oauth2/token/
for example:
/oauth2/token/?code=CODE&secret_key=SECRET_KEY
But i have error 404
I have no idea what’s in the wiki, but yes you need to send a POST request with whatever parameters the OAuth flow you are using requires. That probably means:
client_id - your client’s ID
client_secret - your client’s secret
code - the authorization code the server returned
code_verifier - your verifier value if you’re using PKCE (which you should be if your secret is shared at all)
i send POST request:
data = nil,
headers:
{“client_id”:“CLIENT_ID”,
“redirect_uri”:“osmeditor:/”,
“code”:“CODE”,
“grant_type”:“authorization_code”,
“client_secret”:“CLIENT_SECRET”}
and i get error 415 - The HTTP 415 Unsupported Media Type client error response code indicates that the server refuses to accept the request because the payload format is in an unsupported format.
I understand how it work.
I must send POST request:
data = {“client_id”:“CLIENT_ID”,
“redirect_uri”:“osmeditor:/”,
“code”:“CODE”,
“grant_type”:“authorization_code”,
“client_secret”:“CLIENT_SECRET”}