Emergency

In urgent situations or outages, you can send a text message to our emergency line

Emergency line (text message only)

+45 29 70 15 95

Send a text message with the following information:

  • Your name and webshop
  • A description of the problem

Note: This service is only for critical situations where your webshop is down or has serious problems. For regular support, please use our normal support channels.

OAuth Integration

Build secure integrations with the Shoporama API using OAuth 2.0

What is OAuth?

OAuth lets external applications securely access the Shoporama API on behalf of your users, without them having to share their login credentials.

Secure

No password sharing. Users log in directly with Shoporama

Easy integration

The standard OAuth 2.0 flow you know from other services

Flexible

Choose exactly which permissions your app gets

OAuth flow - step by step

1

Send the user to Shoporama

Your app sends the user to Shoporama's OAuth endpoint

https://www.shoporama.dk/admin/oauth/login?
  client_id=Din_App_Navn
  redirect_uri=https://example.com/callback
  state=unik_session_id
2

User logs in

The user logs in with their Shoporama credentials and chooses:

  • Which store to grant access to
  • Access Level (Read, Write, or Full)

The token is linked to the user. If the user has been assigned a role other than "Full access" in the online store, the token can only perform the actions permitted by that role, regardless of the access level. See Access Level and User Role.

3

Receive the API token

Once approved, the user is sent back to your app with a token:

https://example.com/callback?
  token=50c30350a89565a830eb...
  shop_url=demo.shoporama.dk
  shop_name=Demo Shop
  api_endpoint=https://www.shoporama.dk/REST
  webshop_id=1
  access_level=all
  state=unik_session_id
4

Use the API

Use the token to call the Shoporama API:

curl -H "Authorization: 50c30350a89565a830eb..." \
     https://www.shoporama.dk/REST/product

Ready to get started?

Start by testing the OAuth flow or read more about the API

Complete Implementation Examples

Full OAuth flow implementation, ready to copy and paste

Vanilla PHP Implementation

Plain PHP with no frameworks - a single file that handles the entire OAuth flow

<?php
// oauth.php - Gem denne fil på din server
session_start();

// Konfiguration - RET DISSE VÆRDIER
$CLIENT_ID = "Dit App Navn";
$REDIRECT_URI = "https://din-side.dk/oauth.php";
$OAUTH_URL = "https://www.shoporama.dk/admin/oauth/login";

// Start OAuth
if (isset($_GET["login"])) {
    $_SESSION["state"] = bin2hex(random_bytes(16));
    $url = $OAUTH_URL . "?" . http_build_query([
        "client_id" => $CLIENT_ID,
        "redirect_uri" => $REDIRECT_URI,
        "state" => $_SESSION["state"]
    ]);
    header("Location: $url");
    exit;
}

// Modtag token
if (isset($_GET["token"]) && $_GET["state"] === $_SESSION["state"]) {
    $_SESSION["token"] = $_GET["token"];
    $_SESSION["api_url"] = $_GET["api_endpoint"];
    echo "Success! Token gemt.";
    echo "
Test API"; exit; } // Test API if (isset($_GET["test"]) && isset($_SESSION["token"])) { $ch = curl_init($_SESSION["api_url"] . "/product?limit=1"); curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: " . $_SESSION["token"]]); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch); echo "
" . htmlspecialchars($result) . "
"; exit; } // Start side echo "Login med Shoporama"; ?>

How to use it:

  1. Copy the code into a file named oauth.php
  2. Update $CLIENT_ID and $REDIRECT_URI
  3. Upload the file to your server
  4. Visit the page and click the login link ("Login med Shoporama" in the example)

Troubleshooting & common issues

Common OAuth errors

access_denied

The user denied access. Show a friendly message and let them try again.

invalid_client

Unknown client_id. Check that your app name is correct.

invalid_redirect_uri

Redirect URI does not match. It must be exactly the same URL.

state_mismatch

State parameter does not match. Possible CSRF attack or session timeout.

API errors

401 Unauthorized

The token is invalid, has expired, or has been revoked—for example, because the user has been removed from the store. Ask the user to log in again. If the user has been removed from the store, another user with access to the store must link the app.

403 Forbidden

The token is not allowed to make this call. The "error" field in the response is "insufficient_scope" if the access level does not permit the method, and "insufficient_role" if the role of the user behind the token does not grant access. The "message" field explains why.

429 Too Many Requests

Rate limit reached. Wait before sending the next request.

500 Server Error

Internal error. Try again later or contact support.

Debugging tips

Test with the OAuth Test Client

Use our test client to verify that your OAuth flow works correctly.

Test OAuth flow →

Log all parameters

Log the state, token, and other parameters to debug problems.

Security & best practices

Token storage

  • • Never store tokens in cookies or localStorage
  • • Use server-side sessions or an encrypted database
  • • Encrypt tokens before storing them
  • • Delete tokens when they are no longer used

CSRF protection

  • • Always use the state parameter
  • • Generate a unique state for each session
  • • Verify the state in the callback
  • • Expire the state after a short time

HTTPS required

  • • Use only HTTPS for redirect_uri
  • • All API calls must use HTTPS
  • • Exception: localhost for development
  • • Check SSL certificate validity

Access levels explained

Level Description Allowed Not allowed
read Read access to data GET requests POST, PUT, DELETE requests
write Create, modify, and delete data POST, PUT, DELETE requests GET requests
all Read and write data All HTTP methods –

Recommendation: Start with 'read' access during development, and only upgrade to 'write' or 'all' when your application's functionality requires it.

On the login page, the levels are called Read (read), Write (write), and Full (all). The user's role may further restrict the token; see Access Level and User Role below.

Access Level and User Role

The access level determines which HTTP methods the token is allowed to use. The token is also linked to the user who authorized the access. If the user has been assigned a role other than Full Access on the online store—such as Employee, Marketing, or Developer—the token can only perform the actions permitted by that role, regardless of the access level. This means:

  • GET requires that the role be able to view the area, such as orders or products. POST, PUT, and DELETE require that the role be able to edit it.
  • Statistics (stats and top-products) requires the "Revenue and Statistics" option.
  • To edit cost prices, you need the “Cost prices and profit margin” option. The same applies to the stock settings (minimum stock and cost price, both retrieving and editing them) and updating the stock value. The reports on margin, ABC analysis, and stock turnover require both this option and the “Revenue and Statistics” option. Without this option, cost prices and figures calculated from them (e.g., margin and stock value) are removed from the responses.
  • Deleting products, orders, and customers requires the "Deletion and Bulk Import" option. Bulk import also requires this option—that is, a POST request containing a list of products or customers.
  • Issuing credit notes, canceling orders, and changing their paid status require the "Refunds and Cancellations" option.
  • The "Supplier" role can only retrieve, edit, copy, and restore individual products by ID (and, with the "Deletion and Bulk Import" option, also delete them), as well as retrieve and upload images in the image library. If a supplier has been selected for the user, this applies only to the supplier’s own products. Product lists and brand-new products are managed in the admin panel.
  • If the user is removed from the online store, the token is revoked, and calls return a 401 error.

Users who still have the configuration from before the roles were introduced (the former "Order Management" and "Supplier" checkboxes) will not be restricted until the company administrator selects or changes their role.

The parameters your app receives after authorization do not indicate the user's role. A restriction only becomes apparent when a request is rejected with a 403 error and a response like this:

{
  "error": "insufficient_role",
  "message": "The user behind this token has the role 'Marketing' on this webshop, which does not allow PUT order. Ask the company administrator to change the role.",
  "method": "PUT",
  "path": "order/123",
  "role": ["marketing"],
  "option": null
}

The "role" field shows the user's role, such as "staff," "marketing," or "developer." The "option" field shows the option that the role lacks, such as "refund." If "option" is null, the role does not grant access to the resource or method at all.

The "Full" access level on the login page is not the same as the "Full access" role. If you want your app to have full capabilities, a user with the "Full access" role must approve the access. You can find all the rules in the API documentation, and the roles are described in Roles and Permissions.

Complete API documentation

See all available endpoints, methods, and parameters in our REST API documentation

View API documentation