The CrossRef Export plugin cannot directly deposit data with CrossRef, we get a wrong credentials error even though our credentials are correct.
OJS version 3.3.0.13, PHP 7.4.33, mysql 5.7.37, CrossRef export plugin version 2.1.0.0.
Going to Tools > CrossRef XML Export Plugin > Articles, selecting an article and hitting “Deposit” (with or without “Validate XML” checked), we get the error:
Registration was not successful! The DOI registration server returned an error: '(401 Unauthorized)'.
But:
- The credentials, double-checked with CrossRef, are correct. I’ve tried the simple Role form (which CrossRef says should work) but also
email@server.com/role
with each of our email addresses that CrossRef knows about (technical contact, etc.) I’ve re-entered the password several times, typing it in as well as copy/pasting it. - We’re able to manually deposit OJS-generated XML records through CrossRef’s own administration console.
- Our OJS server is able to do a Curl https request to CrossRef’s API. I’ve tried that with a simple script (see below).
- We have the latest version of the plugin, 2.1.0.0.
- The error happens with automated deposits (as an article is published) as well as when we use Tools > CrossRef XML Exports and select some articles to deposit. I’ve seen that in the
scheduledTasks
logs.
Possibly relevant: our CrossRef password includes an underscore.
Any suggestions re what may cause the error or what further tests I might do?
For reference, here are previous posts I found on the issue:
- 2015-2019: Problems with the DOI-CrossRef automatic registration - #31 by ctgraham doesn’t cover the 401 Unauthorized error.
- 2016: The problem with the DOI registration by using the plugin One user solved the issue by removing an underscore in their CrossRef password: The problem with the DOI registration by using the plugin - #14 by reprabowo .
- 2016: DOI Registration Error using CrossRef - #11 by ctgraham Solved by using an
email@server.com/role
username. - Crossref deposit failure - #2 by asmecher (Fed 2016) Solved by entering correct credentials
- June 2021: CrossRef plugin submission failure Solved by upgrading to OJS 3.1.2 or higher. See also https://community.crossref.org/t/ojs-plugin-submission-failure/1820 on CrossRef’s forum pages.
- Dec 2021: Cannot Deposit Articles DOI Automatically - DOI registration server 'Error 401 unauthorized' Solved by using an
email@server.com/role
username. - Registration was not successful! (Apr 2022) Not solved
- April 2022: Registration was not successful! The DOI registration server returned an error: ' (401 Unauthorized)' Recommends typing in the password manually, and checking the plugin version.
- Oct 2022: 401 unauthorized Probably solved by entering correct credentials (were using a backward slash
email@server.com\role
instead of a forward one).
I contacted CrossRef’s support to check the credentials. Here’s their answer:
That 401 error almost always indicates a problem with your user credentials.
We’re in the midst of a very gradual transition from an authentication system where each Crossref member organization has a single username to a system where any staff member at a member organization can have their own email-based username, which is attached to the organization’s username, which we then call their “role”.
Your account still uses the old system, so you have a single username and its password. There’s no email address involved in your account credentials.
So, in your OJS Crossref XML Export Plugin settings, the username field should contain only: [our username]
And the password field should contain whichever password you created for that username.
If that same username/password combination is still giving you a 401 error in OJS, we may be at the limit of how much we can support you with it. OJS is not our product, so we’re relatively limited in how much we can help with its use.
I’ve tried the recommend username/password. For good measure, I’ve tried various email@server.com/role combinations. None have worked.
Curl test. As suggested in this discussion I’ve tested whether our server could to an (anonymous) SSL cURL request with Crossref. I’ve ran the following script on our server:
<?php
error_reporting(E_ALL);
$request = urlencode('Towards a Unified Theory of High-Energy Metaphysics, Josiah Carberry 2008-08-13');
$request = 'https://api.crossref.org/works?query.bibliographic="'. $request . '"&rows=2';
$ch = curl_init($request);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$response = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
print '[' . $httpcode . ' - ' . strlen($response) . ' chars]'."\n";
?>
The request works, I get a HTTP 200 code:
[200 - 9977 chars]
My next step is to try and change our CrossRef password. In the meanwhile, any help is welcome.