pear / Services_Openstreetmap

Makes communicating with the Open Street Map API, and Nominatim, from PHP intuitive.
https://pear.php.net/package/Services_OpenStreetMap/
BSD 3-Clause "New" or "Revised" License
199 stars 53 forks source link

Oauth 2.0? #229

Open dddesign opened 2 months ago

dddesign commented 2 months ago

is oauth 2.0 supported? if so, can someone give me an example code? if not, this would be very important!!!

check here:

Please note the Future deprecation of HTTP Basic Auth and OAuth 1.0a announcement: https://www.openstreetmap.org/user/pnorman/diary/401157

March 1st, 2024: New OAuth 1.0a application registrations are disabled. Existing applications will not be impacted. HTTP Basic Auth will not be impacted. May 1st, 2024: Sysadmins will start brownouts to find applications that are still using OAuth 1.0a or HTTP Basic Auth June 1st, 2024: OAuth 1.0a and HTTP Basic Auth will be shut down.

https://community.openstreetmap.org/t/oauth-1-0a-and-http-basic-auth-shutdown/108490

sascha-hendel commented 1 week ago

Hi dddesign,

forked the library and extended code to support OAuth2. Two files are changed: https://github.com/sascha-hendel/Services_Openstreetmap/blob/master/Services/OpenStreetMap/Config.php https://github.com/sascha-hendel/Services_Openstreetmap/blob/master/Services/OpenStreetMap/Changeset.php On init You need to provide parameter oauth2_token: $config = array( 'oauth2_token' => 'YOUR_OAUTH2_TOKEN', ... further parameters ); $osm = new Services_OpenStreetMap($config);

The routines to obtain OAuth2 authorization code and in second step the token are not included. Therefore You need to use an OAuth2 library or write your own code.

Hope this helps. My patched library files are in testing stage. If You find an error, please give me a note. I will invoke a pull request to the master branch if things work well after a while.

dddesign commented 1 week ago

thanks, working great!

mnalis commented 1 week ago