Description

Once you have activated the social login, you can log in, creating a user in the background, with existing credentials from another provider (e.g. meta, x, google, etc).

Please, read first DruID Oauth Documentation to learn about Oauth2 protocol and the meaning of each token.

Take into consideration that if there are some terms and conditions related to the entry-point where the user is trying to login, then this method is going to return a 451 and you need to make a call to the Accept Terms and Condition Social endpoint.

You must provide a real external identifier, indicating also a real external provider. In addition, you must provide a context with the token, and its expiry date, that you have obtained by logging the user into the external provider, as well as an email associated with the social network. There are two options for this type of case:

  • If through the configuration the terms and conditions are mandatory, a user will be created with that email address, confirmed, depending on the social network.
  • If the terms and conditions are not mandatory, a user will be created without an email address, and therefore, without confirmation.

Endpoint URL:

 POST https://{your-endpoint-domain.com}/activityid/v1/user/access

Request parameters

ParameterDescriptionTypeRequired
Authorization“Bearer app_token” Literal text Bearer followed by app_token that is the token obtained from /oauth2/token endpointstringyes
Content-TypeThe type of content that will be used for requests to be JSONstringyes
AcceptThe type of content that will be used for responses to be JSONstringyes
FromName of the entry pointstringyes
Accept-LanguageLanguage for this requestLocaleno

Query string parameters

ParameterDescriptionTypeRequiredDefault value
scWith this paramater you can configure how user fields are validated: by default ALL validation errors are returned back to service caller (). If you want to receive only ONE validation error each time, you have to send query String parameter ‘sc=true’booleannofalse

Request example

ParameterDescriptionTypeRequiredValue
actor.idapp_id of the application you are using to log userstringyesapp id
actor.objectTypeType of the object which represents the actor.stringyes‘application’
verbVerb used for the loginstringyes‘access’
object.objectTypeObjectType represents the userstringyes‘user’
object.passwordPassword of the user. it must be send plainstringyesuser password
object.ids.{{external_provider_id}}This is the name of the external identifier of the selected social network through which the login was made. Allowed values are: facebook_id, twitter_id, google_plus_id, linkedin_id, .windows_live_id, .instagram, wechat_id, external_id, apple_id, avet_idstructyes‘google_plus_id’
object.ids.email
.objectType
ObjectType represents the id of the userstringyes‘user_id’
object.ids.{{external_provider_id}}
.value
Value of the external identifier retrieved from the identity provider used in the social networkstringyesexternal identifier id value
context.access_token
.value
Value of the token obtained from the identity provider through which the login was made.stringyestoken value
context.access_token
.expires_at
Expiration date of the token obtained from the identity provider through which the login was made.numberyestimestamp (ms)
context.profíle.emailEmail address associated with the identity provider through which the login was madestringnoemail
source.idType of device doing the activitystringyes‘unknown’ | ‘pc’ | ‘mobile’ | ‘tablet’ | ‘game_console’ | ‘itv’
source.objectTypeType of sourcestringyes‘device’

Response examples

Response: social user logged

ParameterDescriptionType
contentData receive with the responsestruct
content.userData of the user logged with the request. More info about user struct at User Infostruct
content.session_infosession info structurestruct
content.session_info.access_tokenaccess token valuestring
content.session_info.token_typetoken type‘bearer’
content.session_info.expires_inthe remaining lifetime in seconds of the access tokenlong
content.session_info.expires_atepoch time in milliseconds when the token will expire. If you use unix tools to convert time you must discard last 3 digitslong
content.session_info.refresh_tokenRefresh token value. You must use if youre are following “oauth2 refresh token flow”. You can ignore this value in rest of casesstring
content.session_info.login_statusoauth2 server login status of logged userstruct
content.session_info.login_status.uidDRUID of the logged user.It will have the same value of content.user.idlong
content.session_info.login_status.connect_stateoauth2 server connect state‘connected’ | ‘notConnected’ | ‘unknown’
content.session_info.scopescope for which the token was createdstring
result.statushttp status codeinteger

Response: social user login success, but need to accept Terms & Conditions

ParameterDescriptionType
contentData receive with the responsestruct
content.urlThe URL of the requeststring
content.assertionsAssertions info structurestruct
content.assertions.objectTypeType of the objectstring
content.assertions.itemsCollection of the assertions that the users needs to accept to loginstruct
content.assertions.items.objectTypeType of the objectstring
content.assertions.items.displayNameThe content of the assertion.string
content.assertions.items.typeType of assertion.string
content.assertions.items.typologyType of typologystring
content.assertions.items.mandatoryWhether the assertion is mandatoybool
content.assertions.totalItemsSize of the items’ collectioninteger
result.statushttp status codeinteger
result.elapsedTime spent to receive the responseinteger
result.errorsResponse errorsstruct
result.errors.messageDescription of the errorstring

Response codes

CodeTypeDescription
400ErrorBad Request: The request could not be understood by the server due to malformed syntax
401ErrorUnauthorized: authentication is required and has failed or has not yet been provided (token is invalid, etc)
403ErrorForbidden: user id or password are invalid
412ErrorPrecondition failed: User can not log because he/she has not confirmed email
426unlinkedUser not found, but email found in DruID. Please redirect to link account
451ErrorUnavailable For Legal Reasons: user must accept new terms and conditions
500ErrorInternal Server Error: The server encountered an unexpected condition which prevented it from fulfilling the request
504ErrorGateway TimeoutService can not contact with oauth server to do some internal operations
200SuccessUser logged successfully. You will get ‘user logged JSON response’
207SuccessMulti-Status: User logged successfully, but needs to accept Terms & Conditions