Skip to main content

How to fix the POST_REGISTRATION_ERROR when integrating POK with Moodle

POST_REGISTRATION_ERROR appears during the dynamic registration of POK LTI with Moodle (3.10 or later) because the web server hosting Moodle is not passing the Authorization header to PHP, so the registration token POK sends never reaches Moodle. Fix it by adding one directive to your Apache or Nginx configuration, then retry Add LTI Advantage.

What the error looks like

After pasting POK's dynamic Tool URL in Moodle and clicking Add LTI Advantage (in Site administration > Plugins > External tool > Manage tools, on the /mod/lti/toolconfigure.php page), the Manage tools screen shows:

Integration process failed

Integration could not be completed at this time. Code (POST_REGISTRATION_ERROR)

What is actually happening

During dynamic registration, POK sends Moodle a registration token inside the HTTP Authorization header. POK always sends that token (confirmed in POK's logs), yet Moodle's internal error is missing_registration_token.

The most common cause: many Apache-based Moodle servers do not pass the Authorization header to PHP by default. POK sends the token correctly, but Moodle never sees it arrive, so it reports it as missing.

In short: it is not a problem with the token or with POK, but with the configuration of the web server hosting Moodle, which discards the Authorization header before Moodle can read it.

Fix it on Apache

Add the following directive to your Apache configuration so it forwards the Authorization header to PHP:

SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

Where to place it, depending on your setup:

  • In the VirtualHost of the Moodle site, or
  • In the .htaccess file at the root of the Moodle installation, or
  • In the global Apache configuration file (for example apache2.conf / httpd.conf).

After adding the directive:

  1. Save the configuration file.

  2. Reload or restart Apache to apply the change:

    sudo systemctl reload apache2

    The command can vary by system: apache2 or httpd.

If the SetEnvIf directive does not work in your environment, try this .htaccess alternative:

RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [E=HTTP_AUTHORIZATION:%1]

Fix it on Nginx

If your Moodle runs on Nginx with PHP-FPM, add this inside the location block that processes PHP:

fastcgi_param HTTP_AUTHORIZATION $http_authorization;

Then reload Nginx with sudo systemctl reload nginx.

Managed hosting

If you do not administer the server directly (for example, Moodle runs on managed hosting), share this instruction with your hosting provider or infrastructure team so they apply the change.

How to verify the header reaches the server

Before or after applying the change, you can confirm whether the Authorization header is arriving:

  1. Make an HTTP request to your Moodle including an Authorization header, for example with curl:

    curl -H "Authorization: Bearer prueba123" https://your-moodle-domain/
  2. Check the server logs (or a PHP test script that prints $_SERVER['HTTP_AUTHORIZATION']) to see whether the header is received.

    • If it does not appear, the server is discarding it: apply the directive above.
    • If it appears, the header is already being forwarded correctly.

Retry the integration

Once your web server forwards the Authorization header:

  1. Go back to POK and copy the dynamic LTI URL again.
  2. In Moodle, go to Site administration > Plugins > External tool > Manage tools.
  3. Paste the Tool URL copied from POK.
  4. Click Add LTI Advantage to complete the registration.

The registration should now finish without showing POST_REGISTRATION_ERROR.

Quick summary

ItemDetail
Visible errorIntegration could not be completed. Code (POST_REGISTRATION_ERROR)
Moodle internal errormissing_registration_token
Real causeThe web server does not forward the Authorization header to PHP
Fix (Apache)SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
Fix (Nginx)fastcgi_param HTTP_AUTHORIZATION $http_authorization;
Final actionReload the web server and retry Add LTI Advantage

If the error persists after these steps, contact us at contact@pok.tech with your Moodle domain so we can review the token delivery logs.