friendship ended with social-app. php is my new best friend
1<?php 2/** 3 * Class OpenStreetmap 4 * 5 * @created 12.05.2019 6 * @author smiley <smiley@chillerlan.net> 7 * @copyright 2019 smiley 8 * @license MIT 9 */ 10declare(strict_types=1); 11 12namespace chillerlan\OAuth\Providers; 13 14use chillerlan\OAuth\Core\{AuthenticatedUser, OAuth1Provider, UserInfo}; 15 16/** 17 * OpenStreetmap OAuth1 (deprecated) 18 * 19 * @link https://wiki.openstreetmap.org/wiki/API 20 * @link https://wiki.openstreetmap.org/wiki/OAuth 21 * 22 * @deprecated https://github.com/openstreetmap/operations/issues/867 23 */ 24class OpenStreetmap extends OAuth1Provider implements UserInfo{ 25 26 public const IDENTIFIER = 'OPENSTREETMAP'; 27 28 protected string $requestTokenURL = 'https://www.openstreetmap.org/oauth/request_token'; 29 protected string $authorizationURL = 'https://www.openstreetmap.org/oauth/authorize'; 30 protected string $accessTokenURL = 'https://www.openstreetmap.org/oauth/access_token'; 31 protected string $apiURL = 'https://api.openstreetmap.org'; 32 protected string|null $apiDocs = 'https://wiki.openstreetmap.org/wiki/API'; 33 protected string|null $applicationURL = 'https://www.openstreetmap.org/user/{USERNAME}/oauth_clients'; 34 35 /** @codeCoverageIgnore */ 36 public function me():AuthenticatedUser{ 37 $json = $this->getMeResponseData('/api/0.6/user/details.json'); 38 39 $userdata = [ 40 'data' => $json, 41 'avatar' => $json['user']['img']['href'], 42 'displayName' => $json['user']['display_name'], 43 'id' => $json['user']['id'], 44 ]; 45 46 return new AuthenticatedUser($userdata); 47 } 48 49}