oAuth

oAuth implementation for the portals GoedGeplaatst is associated with.

Reference

GET /oauth/<userId>/<portal>/[?useCache=1]

Determine if a user is associated with a specific portal and return the associated credentials.

This endpoint is an alias of oAuth - Connection Status.

POST /oauth/<userId>/<portal>/

Start the oauth-procedure for the specified user / portal

On success, this call will return a url the user has to be redirected to.

Please note: all previous access-tokens will be revoked for the specified user / portal.

DELETE /oauth/<userId>/<portal>/

Revoke the access_token and refresh_token for the specified user / portal.

PUT /oauth/<userId>/<portal>/

Generate an access/refresh-token based on the authorization-code received from the specified portal when a user grants GoedGeplaats access to its account.

Fields oAuth PUT Request

field type constraints Req W U
code text The authorization-code received from the portal. Yes Yes Yes
state text The state received from the portal No Yes Yes

Example Start oAuth Procedure

Request

POST /rest/v1/oauth/12311/marktplaats HTTP/2

Response

{
 "result": false,
 "errors": [],
 "data": {
   "redirect": "https://auth.demo.qa-mp.so/accounts/oauth/authorize?response_type=code&scope=read%2Cwrite&redirect_uri=https%3A%2F%2Fdevelop.goedgeplaatst.nl%2F%3Faction%3Doauthstart&state=authresourceowner"
 }
}

Example Revoke Access

Request

DELETE /rest/v1/oauth/12311/marktplaats HTTP/2

Response

{
 "result": false,
 "errors": [],
 "data": {
   "userId": 12311,
   "portal": "marktplaats",
   "status": false,
   "externalUserId": 0,
   "accessToken": "",
   "accessTokenExpire": "",
   "refreshToken": "",
   "email": "",
   "scope": []
 }
}

Example Retrieve AccessToken/RefreshToken

Request

PUT /rest/v1/oauth/12311/marktplaats HTTP/2
{
 "code": "0e82f50b-1037-45",
 "state": "authresourceowner"
}

Response

{
 "result": true,
 "errors": [],
 "data": {
   "userId": 12311,
   "portal": "marktplaats",
   "status": false,
   "externalUserId": 0,
   "accessToken": "3ed34b28-78eb-424f-9ed3-40cf7e2b3152",
   "accessTokenExpire": "2021-06-10 10:26:30",
   "refreshToken": "0743f965-a26f-4904-aa26-58f49787c8a6",
   "email": "",
   "scope": [
     "write",
     "fitments",
     "car_attributes_editable",
     "update_category",
     "dealer_video",
     "extended_sellername",
     "tenant_mp",
     "outlet",
     "reviews",
     "invoice_allowed",
     "read",
     "update_nap",
     "branding"
   ]
 }
}