Class yii\authclient\clients\LinkedIn

Inheritanceyii\authclient\clients\LinkedIn » yii\authclient\OAuth2 » yii\authclient\BaseOAuth » yii\authclient\BaseClient » yii\base\Component » yii\base\Object
Implementsyii\authclient\ClientInterface, yii\base\Configurable
Available since version2.0
Source Code https://github.com/yiisoft/yii2-authclient/blob/master/clients/LinkedIn.php

LinkedIn allows authentication via LinkedIn OAuth.

In order to use linkedIn OAuth you must register your application at https://www.linkedin.com/secure/developer.

Example application configuration:

'components' => [
    'authClientCollection' => [
        'class' => 'yii\authclient\Collection',
        'clients' => [
            'linkedin' => [
                'class' => 'yii\authclient\clients\LinkedIn',
                'clientId' => 'linkedin_client_id',
                'clientSecret' => 'linkedin_client_secret',
            ],
        ],
    ]
    ...
]

See also:

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__call() Calls the named method which is not a class method. yii\base\Component
__clone() This method is called after the object is created by cloning an existing one. yii\base\Component
__construct() Constructor. yii\base\Object
__get() Returns the value of a component property. yii\base\Component
__isset() Checks if a property is set, i.e. defined and not null. yii\base\Component
__set() Sets the value of a component property. yii\base\Component
__unset() Sets a component property to be null. yii\base\Component
api() Performs request to the OAuth API. yii\authclient\BaseOAuth
attachBehavior() Attaches a behavior to this component. yii\base\Component
attachBehaviors() Attaches a list of behaviors to the component. yii\base\Component
behaviors() Returns a list of behaviors that this component should behave as. yii\base\Component
buildAuthUrl() Composes user authorization URL. yii\authclient\clients\LinkedIn
canGetProperty() Returns a value indicating whether a property can be read. yii\base\Component
canSetProperty() Returns a value indicating whether a property can be set. yii\base\Component
className() Returns the fully qualified name of this class. yii\base\Object
detachBehavior() Detaches a behavior from the component. yii\base\Component
detachBehaviors() Detaches all behaviors from the component. yii\base\Component
ensureBehaviors() Makes sure that the behaviors declared in behaviors() are attached to this component. yii\base\Component
fetchAccessToken() Fetches access token from authorization code. yii\authclient\clients\LinkedIn
getAccessToken() yii\authclient\BaseOAuth
getBehavior() Returns the named behavior object. yii\base\Component
getBehaviors() Returns all behaviors attached to this component. yii\base\Component
getCurlOptions() yii\authclient\BaseOAuth
getId() yii\authclient\ClientInterface
getName() yii\authclient\ClientInterface
getNormalizeUserAttributeMap() yii\authclient\BaseClient
getReturnUrl() yii\authclient\BaseOAuth
getSignatureMethod() yii\authclient\BaseOAuth
getTitle() yii\authclient\ClientInterface
getUserAttributes() yii\authclient\ClientInterface
getViewOptions() yii\authclient\ClientInterface
hasEventHandlers() Returns a value indicating whether there is any handler attached to the named event. yii\base\Component
hasMethod() Returns a value indicating whether a method is defined. yii\base\Component
hasProperty() Returns a value indicating whether a property is defined for this component. yii\base\Component
init() Initializes the object. yii\authclient\clients\LinkedIn
off() Detaches an existing event handler from this component. yii\base\Component
on() Attaches an event handler to an event. yii\base\Component
refreshAccessToken() Gets new auth token to replace expired one. yii\authclient\OAuth2
setAccessToken() yii\authclient\BaseOAuth
setCurlOptions() yii\authclient\BaseOAuth
setId() yii\authclient\ClientInterface
setName() yii\authclient\ClientInterface
setNormalizeUserAttributeMap() yii\authclient\BaseClient
setReturnUrl() yii\authclient\BaseOAuth
setSignatureMethod() yii\authclient\BaseOAuth
setTitle() yii\authclient\ClientInterface
setUserAttributes() yii\authclient\BaseClient
setViewOptions() yii\authclient\BaseClient
trigger() Triggers an event. yii\base\Component

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
apiInternal() Performs request to the OAuth API. yii\authclient\clients\LinkedIn
composeRequestCurlOptions() Composes HTTP request CUrl options, which will be merged with the default ones. yii\authclient\OAuth2
composeUrl() Composes URL from base URL and GET params. yii\authclient\BaseOAuth
convertXmlToArray() Converts XML document to array. yii\authclient\BaseOAuth
createSignatureMethod() Creates signature method instance from its configuration. yii\authclient\BaseOAuth
createToken() Creates token from its configuration. yii\authclient\OAuth2
defaultCurlOptions() Returns default cURL options. yii\authclient\BaseOAuth
defaultName() Generates service name. yii\authclient\clients\LinkedIn
defaultNormalizeUserAttributeMap() Returns the default $normalizeUserAttributeMap value. yii\authclient\clients\LinkedIn
defaultReturnUrl() Composes default $returnUrl value. yii\authclient\clients\LinkedIn
defaultTitle() Generates service title. yii\authclient\clients\LinkedIn
defaultViewOptions() Returns the default $viewOptions value. yii\authclient\BaseClient
determineContentTypeByHeaders() Attempts to determine HTTP request content type by headers. yii\authclient\BaseOAuth
determineContentTypeByRaw() Attempts to determine the content type from raw content. yii\authclient\BaseOAuth
generateAuthState() Generates the auth state value. yii\authclient\clients\LinkedIn
getState() Returns persistent state value. yii\authclient\BaseOAuth
getStateKeyPrefix() Returns session key prefix, which is used to store internal states. yii\authclient\BaseOAuth
initUserAttributes() Initializes authenticated user attributes. yii\authclient\clients\LinkedIn
mergeCurlOptions() Merge CUrl options. yii\authclient\BaseOAuth
normalizeUserAttributes() Normalize given user attributes according to $normalizeUserAttributeMap. yii\authclient\BaseClient
processResponse() Processes raw response converting it to actual data. yii\authclient\BaseOAuth
removeState() Removes persistent state value. yii\authclient\BaseOAuth
restoreAccessToken() Restores access token. yii\authclient\BaseOAuth
saveAccessToken() Saves token as persistent state. yii\authclient\BaseOAuth
sendRequest() Sends HTTP request. yii\authclient\BaseOAuth
setState() Sets persistent state. yii\authclient\BaseOAuth

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
CONTENT_TYPE_AUTO 'auto' yii\authclient\BaseOAuth
CONTENT_TYPE_JSON 'json' yii\authclient\BaseOAuth
CONTENT_TYPE_URLENCODED 'urlencoded' yii\authclient\BaseOAuth
CONTENT_TYPE_XML 'xml' yii\authclient\BaseOAuth

Property Details

$apiBaseUrl public property
$apiBaseUrl 'https://api.linkedin.com/v1'
$attributeNames public property (available since version 2.0.4)
array $attributeNames = ['id''email-address''first-name''last-name''public-profile-url']

List of attribute names, which should be requested from API to initialize user attributes.

$authUrl public property
$authUrl 'https://www.linkedin.com/uas/oauth2/authorization'
$tokenUrl public property
$tokenUrl 'https://www.linkedin.com/uas/oauth2/accessToken'

Method Details

apiInternal() protected method

Performs request to the OAuth API.

array apiInternal$accessToken$url$method, array $params, array $headers )
$accessToken yii\authclient\OAuthToken

Actual access token.

$url string

Absolute API URL.

$method string

Request method.

$params array

Request parameters.

$headers array

Additional request headers.

return array

API response.

throws yii\base\Exception

on failure.

buildAuthUrl() public method

Composes user authorization URL.

string buildAuthUrl( array $params = [] )
$params array

Additional auth GET params.

return string

Authorization URL.

defaultName() protected method

Generates service name.

string defaultName( )
return string

Service name.

defaultNormalizeUserAttributeMap() protected method

Returns the default $normalizeUserAttributeMap value.

Particular client may override this method in order to provide specific default map.

array defaultNormalizeUserAttributeMap( )
return array

Normalize attribute map.

defaultReturnUrl() protected method

Composes default $returnUrl value.

string defaultReturnUrl( )
return string

Return URL.

defaultTitle() protected method

Generates service title.

string defaultTitle( )
return string

Service title.

fetchAccessToken() public method

Fetches access token from authorization code.

yii\authclient\OAuthToken fetchAccessToken$authCode, array $params = [] )
$authCode string

Authorization code, usually comes at $_GET['code'].

$params array

Additional request params.

return yii\authclient\OAuthToken

Access token.

generateAuthState() protected method

Generates the auth state value.

string generateAuthState( )
return string

Auth state value.

init() public method

Initializes the object.

This method is invoked at the end of the constructor after the object is initialized with the given configuration.

void init( )
initUserAttributes() protected method

Initializes authenticated user attributes.

array initUserAttributes( )
return array

Auth user attributes.