Usage

Partner logs in a user via o2o API

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

POST Log in biker

Request

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:

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.

Response

Success

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.

Errors