To log in a user:
sequenceDiagram
participant U1 as User browser
participant P1 as Partner system
participant O1 as o2o API server
participant O2 as myo2o Biker server
U1->>P1: 1. User expresses "interested in bike lease"
P1->>O1: 2. POST Login user
opt Create new biker account?
O1-->>O1: 3. Register Person
end
O1-->>O2: 4. Request temporary login token
O2-->>O1: 4. Response
O1->>P1: 2. Response
P1-->>U1: 5. Redirect user to myo2o Biker
U1-->>O2: 6. Login
O2-->>U1: Return Biker home page
Note right of U1: User is logged in and sees myo2o Biker homepage
For each user to be logged in, Partner sends this message to o2o:
POST https://{{o2o_api_server}}/receiver/APIv3/user.login
{
"user": {
"bikePlanCode": "a valid bikeplan code",
"firstName": "Jane",
"lastName": "Johansson",
"email": "[email protected]",
"language": "FR",
"contractType": "",
"partner_PersonID": "ABC123",
"personnelNumber": "A1234",
"partner_additionalData": {
...
}
}
}
Info:
user object in the payload contains the data for the user that needs to be logged in:
bikePlanCode: the bike plan registration code for the bike plan to which the user will have access. This code is provided by o2o during the onboarding of our mutual client. In principle o2o supports different bike plans per client if some settings on o2o’s side need to be different for certain sets of users.firstName, lastName, email: self-explanatory data for the userlanguage: currently supported values are
NL: DutchFR: FrenchEN: EnglishcontractType: currently supported values are
clerkworkerpartner_PersonID: an ID used by Partner to identify the user. This field is not mandatory, but might facilitate later precise communication between o2o and Partner.personnelNumber: an internal number identifying the user within their company. This field is not mandatory. If provided, this will be included on the invoice lines we send to the client.partner_additionalData: an optional field that can be used to communicate additional data that is needed for later API calls between Partner and o2o.Note that, by default, the email address is used as a unique identifier for the user, and in any case our system does not allow two users to share the same email address.
If the user was created successfully, then the result should look like this:
Status: 201 Created
{
"result": "User was created.",
"success": true,
"loginUrl": "https://..."
}
If the user already existed and the login was successful, the the result should look like this:
Status: 200 OK
{
"result": "User was updated.",
"success": true,
"loginUrl": "https://..."
}
The returned URL can be used for 5 minutes in order to let the user log in.