Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace OAuth\Plugin;
- class DoorkeeperAdapter extends AbstractAdapter {
- /**
- * Retrieve the user's data
- *
- * The array needs to contain at least 'user', 'mail', 'name' and optional 'grps'
- *
- * @return array
- */
- public function getUser() {
- $JSON = new \JSON(JSON_LOOSE_TYPE);
- $data = array();
- /** var OAuth\OAuth2\Service\Generic $this->oAuth */
- $result = $JSON->decode($this->oAuth->request('https://esi.evetech.net/latest/swagger.json'));
- $data['user'] = 'eve-'.$result['character_id'];
- $data['name'] = 'eve-'.$result['character_id'];
- $data['mail'] = $result['character_id'];
- if( !empty($result['corporation_id']) )
- {
- $data['grps'] = $result['corporation_id'];
- }
- $data['grps'] = $result['corporation_id'];
- return $data;
- }
- /**
- * We make use of the "Generic" oAuth 2 Service as defined in
- * phpoauthlib/src/OAuth/OAuth2/Service/Generic.php
- *
- * @return string
- */
- public function getServiceName() {
- return 'Generic';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment