4 * Authentication adapter for WordPress.com OAuth2.
6 final class PhutilWordPressAuthAdapter
extends PhutilOAuthAuthAdapter
{
8 public function getAdapterType() {
12 public function getAdapterDomain() {
13 return 'wordpress.com';
16 public function getAccountID() {
17 return $this->getOAuthAccountData('ID');
20 public function getAccountEmail() {
21 return $this->getOAuthAccountData('email');
24 public function getAccountName() {
25 return $this->getOAuthAccountData('username');
28 public function getAccountImageURI() {
29 return $this->getOAuthAccountData('avatar_URL');
32 public function getAccountURI() {
33 return $this->getOAuthAccountData('profile_URL');
36 public function getAccountRealName() {
37 return $this->getOAuthAccountData('display_name');
40 protected function getAuthenticateBaseURI() {
41 return 'https://public-api.wordpress.com/oauth2/authorize';
44 protected function getTokenBaseURI() {
45 return 'https://public-api.wordpress.com/oauth2/token';
48 public function getScope() {
52 public function getExtraAuthenticateParameters() {
54 'response_type' => 'code',
59 public function getExtraTokenParameters() {
61 'grant_type' => 'authorization_code',
65 protected function loadOAuthAccountData() {
66 return id(new PhutilWordPressFuture())
67 ->setClientID($this->getClientID())
68 ->setAccessToken($this->getAccessToken())
69 ->setRawWordPressQuery('/me/')