Description

You have to call this method when you want to log in an user in your application with DRUID.

If you successfully log in an user in DRUID, you will receive an access_token (that you could use to call other resources that need an user session); you also get all information of the logged user.

Please, read first: https://dru-id.com/developers/apis/oauth-2/ to learn about Oauth2 protocol and the meaning of each token.

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
fcaForce to check complete account after successful login. If user needs to complete data you will receive same response defined in complete account 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.emailStructure of email identifier. node name must be “email”structyesemail
object.ids.email.objectTypeObjectType represents the id of the userstringyes‘user_id’
object.ids.email.valueEmail valuestringyesemail
source.idType of device doing the activitystringyes‘unknown’ | ‘pc’ | ‘mobile’ | ‘tablet’ | ‘game_console’ | ‘itv’
source.objectTypeType of sourcestringyes‘device’

Response examples

Response: 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: user login success, but need to complete data

This request is made with request parameter fca=true

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
result.elapsedTime spent to receive the responseinteger
errorsResponse errorsstruct
errors.messageErrors messagestring
errors.detailsErrors detailstring

Response KO: Terms & Conditions not approved by the user

ParameterDescriptionType
contentData receive with the responsestruct
content.urlRedirect url to accessstring
content.assertionsStruct for assertionsstruct
content.assertions.objectTypeObjectType representing the assertions struct. Will be “assertions”string
content.assertions.itemsList of assertionsarray
content.assertions.items[n].objectTypeObjectType representing the assertion. Will be “assertion”string
content.assertions.items[n].displayNameText message with the detail ot the assertion and the reference to show to the userstring
content.assertions.items[n].typeAssertion typestring
content.assertions.items[n].mandatoryDefine if assertion is mandatory: user MUST accept assertions that are mandatoryboolean
content.assertions.items[n].typologyTipology of the assertionstring
content.assertions.items[n].propertyProperty of the assertionstring

Response: User not logged. The user hasn’t been confirmed

ParameterDescriptionType
contentData receive with the responsestruct
content.urlRedirect url to access to send the confirm code to the userstring

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
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’
206SuccessPartial content: User logged successfullybut needs some data to be completed