Skip to main content

OAuth

We support the usage of other OAuth servers, both for users with existing authentication and for those without any existing OAuth setup.

SSO is configured with us — you still work with Bidlogix to set up and validate the integration. The contract below is what your developers need in order to build the user endpoint and token hand-off correctly the first time.

Requirements​

  • You have your OAuth / OpenID Connect server set up
  • The OAuth server has an endpoint that returns user details based on the token (commonly referred to as a /user or /userinfo endpoint)
  • The token your identity provider issues is readable by JavaScript on the BidJS page's origin
  • The authentication token is published as either a cookie or a localStorage item in the client browser

A typical user endpoint URL looks like:

https://<YOUR_AUTH0_DOMAIN>/userinfo

How your user endpoint is called​

When a user completes login with your identity provider, BidJS calls your user endpoint to retrieve their profile. The request is authenticated as follows:

Authorization: Bearer <token>

The token your identity provider issued is forwarded exactly as received, as a bearer credential. Your endpoint must accept this header on every call.

You must tell us whether your endpoint expects GET or POST. We support either — this is a configuration choice on your side, not something BidJS infers. Include the HTTP method when you send us the endpoint details.

You do not need to match our field names​

Your user endpoint can return whatever shape of response your system already produces. You do not need to rename fields, flatten nested objects, or restructure anything to match BidJS's internal field names.

Instead:

  • Send us an example response from your endpoint (using representative test data)
  • We configure a userObjectMap that maps your response's field names — including nested fields and array indexes — onto BidJS fields (see Response fields)
  • If your response is missing a field BidJS uses (for example, if your system does not track a phone number), we can configure a userDefaultsMap to supply a default value instead

This mapping is configured once, during setup, and does not need to be revisited unless your response shape changes.

Response fields​

After mapping (if one is configured), BidJS looks for the fields below. emailAddress and country are required: email matches or creates the BidJS account, and country must be supplied rather than left to us to guess. The others can be filled from userDefaultsMap or left blank — but the recommended fields are what BidJS uses to treat the profile as complete, and without them the user may be asked to supply details after login.

FieldStatusNotes
emailAddressRequiredUsed to match or create the BidJS account
countryRequired2-digit ISO 3166-1 alpha-2 code — see below
forenameRecommendedFirst name
surnameRecommendedLast name
addressLine1RecommendedFirst line of the address
cityRecommendedCity
postcodeRecommendedPostcode / ZIP code
phoneNumberRecommendedDaytime telephone number
companyNameOptionalCompany name
addressLine2OptionalSecond line of the address
countyOptionalCounty / region / state
externalRefOptionalYour own identifier for the user
outbidEmailsOkOptionalBoolean or "true" / "false" — see below

country must be the 2-digit ISO 3166-1 alpha-2 code, for example GB (United Kingdom), US (United States), or FR (France). Any other value will not resolve to a country.

outbidEmailsOk can be a JSON boolean (true / false) or the strings "true" / "false". If it is omitted or mapped to an empty string, the web application's outbid-email configuration is used instead. If you want a fixed value, we can set it through userDefaultsMap.

We can also map a username if your response includes one.

Example mapped response​

{
"emailAddress": "jane.doe@example.com",
"forename": "Jane",
"surname": "Doe",
"companyName": "Example Auctions Ltd",
"addressLine1": "1 High Street",
"addressLine2": "",
"city": "London",
"county": "Greater London",
"postcode": "SW1A 1AA",
"country": "GB",
"phoneNumber": "+44 20 7946 0000",
"externalRef": "CUST-00123",
"outbidEmailsOk": "true"
}

Security requirements​

BidJS does not independently verify your identity provider's token — it does not check the token's signature or expiry. This is by design: your user endpoint is the single point where the token is checked.

Your user endpoint must return a non-2xx status if the token it receives is expired, invalid, or fails your own verification. If your endpoint returns a 2xx response regardless of token validity, BidJS has no other way to detect that the token should not have been accepted, and login will incorrectly proceed.

Token storage and origin​

Earlier versions of this page stated that SSO requires authenticating the user "onto the same domain". That is not the requirement, and it can lead to the wrong setup.

The actual requirement is that the token must be readable by JavaScript running on the BidJS page's origin. That is what lets the page pick up the token after the redirect and pass it on to BidJS.

If you store the token in localStorage, it is already origin-scoped.

If you store the token in a cookie instead:

  • The cookie Domain and Path must allow JavaScript on the BidJS page's origin to read it (document.cookie)
  • Set Secure, otherwise modern browsers will reject the cookie over HTTPS
  • Set SameSite=Lax (typical for a top-level redirect back from your identity provider) or SameSite=None; Secure if your redirect flow is treated as cross-site

Scenario with an existing authentication​

If you have an existing OAuth server for authentication, you can integrate it with BidJS as follows:

  • Ensure the token is readable by JavaScript on the BidJS page's origin
  • Issue an authentication token that can be published either as a cookie or a localStorage item on the client browser
  • The token name (tokenName) should match the name of your existing cookie or localStorage item
  • Provide a user endpoint that returns user details based on the token, and tell us whether it is GET or POST

Scenario without an existing authentication​

If you do not have an existing authentication, you can still integrate OAuth with BidJS by setting up an OAuth server and obtaining an authentication token.

  • The tokenName can be anything you prefer if you do not have an existing token name. A common value is authToken
  • Store the token in either a cookie or localStorage so JavaScript on the BidJS page's origin can read it
  • The loginUrl should include the scope parameter, which should contain openid profile email so that the necessary user information is gathered

Example login URL​

Your loginUrl should look something like this:

loginUrl: 'https://www.yourdomain.com/auth?redirect_to=<<REDIRECT>>&scope=openid%20profile%20email'

In this scenario, it is common to create a new page called /auth to handle the authentication response and extract the access token from the URL.

Example auth page to store the token​

Below is an example of how you can create an /auth page to extract the access_token from the URL and store it either in a cookie or localStorage.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Auth Page</title>
</head>
<body>
<script>
// Extract the access token from the URL hash
const hash = window.location.hash.substring(1);
const params = new URLSearchParams(hash);
const accessToken = params.get("access_token");

if (accessToken) {
// Store the token in localStorage
localStorage.setItem("authToken", accessToken);
// Optionally, store the token as a cookie (readable on this origin)
document.cookie =
"authToken=" + accessToken +
"; path=/; Secure; SameSite=Lax";

// BidJS replaces <<REDIRECT>> with the origin only (no path).
// Restore a deep-link destination yourself if you captured one.
window.location.href = "/";
} else {
console.error("Access token not found in URL");
}
</script>
</body>
</html>

<<REDIRECT>> is replaced with window.location.origin only. It does not include the path, query string, or hash the user was on.

If a user starts SSO login from a deep link (for example a specific lot or auction page, rather than your site root), your integration is responsible for restoring that destination after login completes. BidJS does not restore it for you.

Capture the original destination yourself (for example via state in the OAuth request, or a value you store before redirecting to the identity provider) and send the user there once the token has been stored.

If you want BidJS to send users to a specific URL rather than the origin, you can hard-code that URL in loginUrl instead of using <<REDIRECT>>.

Setup​

  1. Contact support@bidlogix.net, supplying us with:
    • The user endpoint URL
    • The HTTP method (GET or POST)
    • An example response from that endpoint
  2. We configure the endpoint, method, userObjectMap, and any userDefaultsMap on your account.
  3. Add the OAuth options to your BidJS configuration, as below:
  window.bidjs = {
config: {
...
},
modules: {
...
},
options: {
oAuth: {
isTokenLocalStorage: true, // Set to false if using a cookie
loginUrl: 'https://www.yourdomain.com/auth?redirect_to=<<REDIRECT>>',
logoutUrl: 'https://www.yourdomain.com/logout',
tokenName: 'authToken' // This can be any name you choose
}
}
}

If isTokenLocalStorage is false, then we assume your OAuth credentials are stored as a cookie.

If you do not have an existing authentication, then you need to add the scope parameter to the loginUrl.

The tokenName is either the name of the cookie or the localStorage item.

Worked example​

The following is a complete reference you can check your implementation against. It uses a typical OpenID Connect userinfo payload (the same claim surface as Auth0, Okta, Microsoft Entra, and Keycloak). You would send a response like this to us; we map it — you do not need to reshape it.

Example user endpoint response​

GET or POST /userinfo, with Authorization: Bearer <token>.

A valid token returns 200 and a body such as:

{
"sub": "f:123:jane",
"email": "jane.doe@example.com",
"email_verified": true,
"given_name": "Jane",
"family_name": "Doe",
"name": "Jane Doe",
"phone_number": "+44 20 7946 0000",
"address": {
"street_address": "1 High Street",
"locality": "London",
"region": "Greater London",
"postal_code": "SW1A 1AA",
"country": "GB"
}
}

An expired or invalid token must return a non-2xx status, for example 401.

How that response is mapped​

We configure userObjectMap against your example. Nested fields and array indexes are supported, for example:

  • email → emailAddress
  • given_name → forename
  • family_name → surname
  • address.street_address → addressLine1
  • address.locality → city
  • address.region → county
  • address.postal_code → postcode
  • address.country → country
  • phone_number → phoneNumber
  • sub → externalRef

Fields your payload does not include (companyName, addressLine2, outbidEmailsOk) are filled from userDefaultsMap, for example companyName: "", addressLine2: "", outbidEmailsOk: "true".

After mapping, BidJS receives the same shape as the example mapped response above.

BidJS configuration for this example​

  window.bidjs = {
config: {
...
},
modules: {
...
},
options: {
oAuth: {
isTokenLocalStorage: true,
loginUrl: 'https://www.yourdomain.com/auth?redirect_to=<<REDIRECT>>&scope=openid%20profile%20email',
logoutUrl: 'https://www.yourdomain.com/logout',
tokenName: 'authToken'
}
}
}

Store authToken in localStorage on the BidJS page's origin after the identity-provider redirect. BidJS then forwards that token to your user endpoint as Authorization: Bearer <token>.

Account deletion​

When account deletion is enabled, My Settings lets a signed-in user submit a deletion request.

The request does not delete or deactivate the account. A user with permission to manage users in the BidJS admin site deactivates the account, and later deletes the personal data. The notification tells the auctioneer which account to act on.

If your site builds its own account page, send the request yourself:

POST /auction-007/api/v1/deleteAccount
Authorization: Bearer <BidJS access token>
x-forwarded-client-id: <client id>

The token is the BidJS access token issued after SSO login. It is not the token from your identity provider. The request has no fields.

StatusMeaning
202The request was accepted
401The caller is not a signed-in BidJS user
409A deletion request already exists for this user

The BidJS SDK exposes the same call as bidjs.public.deleteAccount.v1.post() after bidjs.setAccessToken().