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