hwi / HWIOAuthBundle

OAuth client integration for Symfony. Supports both OAuth1.0a and OAuth2.
MIT License
2.27k stars 797 forks source link

What HWIOAuthBundle is expecting form the infos_url ? #1088

Closed mappedinn closed 6 years ago

mappedinn commented 8 years ago

Hi,

I am trying to config my oauth2 server with HWIOAuthBundle and I would like to have some clarifications on what HWIOAuthBundle is expecting as response to config correctly infos_url?

I guess it is expecting a json file. So, what are its fields? If you have links, I will be happy.

hwi_oauth:
    firewall_name: main
    resource_owners:
        battlenet:
            type: oauth2
            client_id: "%client_id%"
            client_secret: "%client_secret%"
            access_token_url: %path%/oauth/token
            authorization_url:  %path%/oauth/authorize
            infos_url:  %path%/user/me
            scope: "read"
            user_response_class: HWI\Bundle\OAuthBundle\OAuth\Response\PathUserResponse
            paths:
                identifier: id
                nickname: id
                realname: id

Thanks ;)

guillaumepotier commented 7 years ago

Basically, info from infos_url endpoint must serve a valid json answer.

PathUserResponse specifically maps these fields:

protected $paths = array(
    'identifier' => null,
    'nickname' => null,
    'firstname' => null,
    'lastname' => null,
    'realname' => null,
    'email' => null,
    'profilepicture' => null,
);

You totally can implement your own UserResponse class that extends that one to add some specific fields for your needs.