Authentication & Tokens

The Authentication API allows you to authenticate users on your end and redirect them as authenticated users back to vivenu. After successful login on your end, you should issue an exchange token and redirect the user back to the appropriate page.

Endpoints

Create an exchange token

After issuing an exchange token, you should redirect the user back to the vivenu to be logged in.
The url the user should be redirected to can be created as follows. Append the recently created token as exchangeToken query parameter to the redirect_uri.

Notice: redirect_uri is a query param that we provide when we request a login.

Payload

One of
Only one of the following types
resourceType
Required
string

The type of the resource to create an exchange token for

customer
customerId
Required
string

The id of the customer to create an exchange token for

Responses
200
OK
400
Bad Request
401
Unauthorized

Was this section helpful?

YesNo
post
/api/auth/exchange-token
{
"resourceType": "customer",
"customerId": "string"
}
Response
application/json
{
"exchangeToken": "string",
"expiresIn": 900
}
PUBLIC

Exchange a token

In order to receive an access token, you need to provide the created exchange token to this endpoint. This might be useful if you need to access authenticated customer APIs in order to create your own account experiences.

Payload

exchangeToken
Required
string

The token to be exchanged for an access token

Responses
200
OK
400
Bad Request

Was this section helpful?

YesNo
post
/api/auth/token
{
"exchangeToken": "string"
}
Response
application/json
{
"token": "string",
"expiresIn": 3600
}
PUBLIC

Returning to vivenu

Notice: You do not need to know the details of this endpoint when you redirect the user back to vivenu using the redirect_uri parameter, as described in the section above.

In case you do not have a redirect_uri, for example when initiating the authentication process yourself (redirecting a user from your page to vivenu), this is the endpoint you should redirect the user to. The redirect_uri you need to provide for this endpoint will be the url the user should be redirected on when the authentication process is complete. This could be the url of your seller page, for example.

Query

exchangeToken
Required
string

The exchange token that was issued to you by vivenu.

redirect_uri
Required
string

The url to which you want to redirect the user after he is signed in.

GET
/seller/{id}/auth/redirect