Developers

Provider

Whenever you're dealing with a provider in your template, you're actually working with a Provider object.

Properties

name

Type: string

The name of the provider.

handle

Type: string

The handle of the provider.

enabled

Type: bool

Whether the provider is enabled.

primaryColor

Type: string|null

The primary brand color of the provider.

icon

Type: string|null

The SVG icon of the provider.

loginEnabled

Type: bool

Whether the provider is enabled for login.

cpLoginEnabled

Type: bool

Whether the provider is enabled for control panel login.

matchUserSource

Type: string

The handle of the field (from the provider API) to use when matching an existing Craft user.

Automatic first-time matching accepts email when the provider confirms that address, or id for the provider's stable account identifier. After the connection is created, Social Login uses the stored provider identifier rather than repeating profile-field matching.

matchUserDestination

Type: string

The handle of the field (in Craft) to use when matching an existing Craft user.

Provider ID matching is case-sensitive and exact. Verified email matching follows Craft's normal email comparison. Either match must resolve to one Craft user. If the provider cannot confirm an email, have the user sign in locally and connect the provider instead.

fieldMapping

Type: array

A definition for how provider API fields should map to Craft user fields.

authorizationOptions

Type: array

A collection of options use in the Authorization URL.

scopes

Type: array

A collection of scopes use in the Authorization URL.

customProfileFields

Type: array

A collection of custom fields to be included alongside default ones.

Methods

getToken()

Returns the OAuth access token.

OAuth Provider

Most, if not all providers use the Auth (opens new window) plugin to handle the bulk of authentication work. As such, they inherit those classes.

Properties

clientId

The OAuth client ID.

clientSecret

The OAuth client secret.

Methods

getOAuthVersion()

The OAuth version (1 or 2).

getIsOAuth1()

Whether is OAuth 1.

getIsOAuth2()

Whether is OAuth 2.

getOAuthProviderConfig()

Returns an array of config for the OAuth provider.

getOAuthProvider()

Returns the OAuth provider.

getAuthorizationUrlOptions()

The array of options for the Authorization URL.

getAuthorizationUrl()

The Authorization URL used to redirect to the provider.

getAccessToken()

Fetches the access token from the provider upon callback.

request(method, uri, options)

Returns the result from an authenticated API request.