|
| 1 | +# ORCID |
| 2 | + |
| 3 | +Janeway lets users register and log in with their ORCID account. |
| 4 | + |
| 5 | +## Setting up ORCID login |
| 6 | + |
| 7 | +It can be set up in a few steps. |
| 8 | + |
| 9 | +1. Create an API client on orcid.org. |
| 10 | + |
| 11 | +2. Enter each production domain for your Janeway instance as a redirect URL on orcid.org. If Janeway is set to domain mode, each journal will need its own redirect URI. |
| 12 | + |
| 13 | +3. Enable ORCID and copy the keys from your client into the Django settings file (`src/core/settings.py`). |
| 14 | + |
| 15 | +```py |
| 16 | +ENABLE_ORCID = True |
| 17 | +ORCID_CLIENT_SECRET = "your client secret" |
| 18 | +ORCID_CLIENT_ID = "your client ID" |
| 19 | +``` |
| 20 | + |
| 21 | +Note that the URLs for the ORCID API are fixed, so you can leave the defaults in `src/core/janeway_global_settings.py`. |
| 22 | + |
| 23 | +## Testing ORCID login manually |
| 24 | + |
| 25 | +You can test the ORCID login flow locally, by creating a test client, adjusting your hosts file, and resetting the Janeway domain for the site you want to test. |
| 26 | + |
| 27 | +The following steps were written for Ubuntu, and are meant for testing the press site. |
| 28 | + |
| 29 | +1. Create a test client on orcid.org and enter a normal domain of your choosing (it won’t be accessed) with `http` and the Janeway port you use for development: `http://www.openlibhums.org:8000/` |
| 30 | + |
| 31 | +2. Edit your hosts file to put in the domain from the redirect URI that orcid.org knows about, in place of the `localhost` domain: |
| 32 | + |
| 33 | +```sh |
| 34 | +sudo vim /etc/hosts |
| 35 | +``` |
| 36 | + |
| 37 | +``` |
| 38 | +127.0.0.1 www.openlibhums.org |
| 39 | +``` |
| 40 | + |
| 41 | +This will let orcid.org redirect your browser to the domain it knows about when authentication is finished, while allowing your browser to load the normal Janeway development server. |
| 42 | + |
| 43 | +3. Restart the networking service for the change to take effect. |
| 44 | + |
| 45 | +``` |
| 46 | +sudo systemctl restart NetworkManager |
| 47 | +``` |
| 48 | + |
| 49 | +4. Edit your Janeway site domain to the same domain, keeping the port number. |
| 50 | + |
| 51 | +``` |
| 52 | +python src/manage.py alter_domains press |
| 53 | +Altering domain for Test A, current domain: localhost:8000 |
| 54 | +Enter the new domain you wish to set: www.openlibhums.org:8000 |
| 55 | +Altering domain record...... [Ok] |
| 56 | +``` |
| 57 | + |
| 58 | +5. Load the site at the new domain with `http` and the correct port (`http://www.openlibhums.org:8000/`) and test away. |
0 commit comments