Skip to content

Commit

Permalink
update orcid env var names (#446)
Browse files Browse the repository at this point in the history
  • Loading branch information
PeopleMakeCulture authored and dwinston committed Feb 2, 2024
1 parent 308b654 commit beb2813
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ NEON_API_TOKEN=y
NEON_API_BASE_URL=https://data.neonscience.org/api/v0

NERSC_USERNAME=replaceme
ORCID_CLIENT_ID=replaceme
ORCID_CLIENT_SECRET=replaceme
ORCID_NMDC_CLIENT_ID=replaceme
ORCID_NMDC_CLIENT_SECRET=replaceme
4 changes: 2 additions & 2 deletions nmdc_runtime/api/core/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

SECRET_KEY = os.getenv("JWT_SECRET_KEY")
ALGORITHM = "HS256"
ORCID_CLIENT_ID = os.getenv("ORCID_CLIENT_ID")
ORCID_CLIENT_SECRET = os.getenv("ORCID_CLIENT_SECRET")
ORCID_NMDC_CLIENT_ID = os.getenv("ORCID_NMDC_CLIENT_ID")
ORCID_NMDC_CLIENT_SECRET = os.getenv("ORCID_NMDC_CLIENT_SECRET")

# https://orcid.org/.well-known/openid-configuration
# XXX do we want to live-load this?
Expand Down
6 changes: 3 additions & 3 deletions nmdc_runtime/api/endpoints/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
Token,
ACCESS_TOKEN_EXPIRES,
create_access_token,
ORCID_CLIENT_ID,
ORCID_NMDC_CLIENT_ID,
ORCID_JWK,
ORCID_JWS_VERITY_ALGORITHM,
credentials_exception,
ORCID_CLIENT_SECRET,
ORCID_NMDC_CLIENT_SECRET,
)
from nmdc_runtime.api.core.auth import get_password_hash
from nmdc_runtime.api.core.util import generate_secret
Expand All @@ -40,7 +40,7 @@ async def receive_orcid_code(request: Request, code: str, state: str | None = No
rv = requests.post(
"https://orcid.org/oauth/token",
data=(
f"client_id={ORCID_CLIENT_ID}&client_secret={ORCID_CLIENT_SECRET}&"
f"client_id={ORCID_NMDC_CLIENT_ID}&client_secret={ORCID_NMDC_CLIENT_SECRET}&"
f"grant_type=authorization_code&code={code}&redirect_uri={BASE_URL_EXTERNAL}/orcid_code"
),
headers={
Expand Down
4 changes: 2 additions & 2 deletions nmdc_runtime/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
ensure_unique_id_indexes,
REPO_ROOT_DIR,
)
from nmdc_runtime.api.core.auth import get_password_hash, ORCID_CLIENT_ID
from nmdc_runtime.api.core.auth import get_password_hash, ORCID_NMDC_CLIENT_ID
from nmdc_runtime.api.db.mongo import (
get_mongo_db,
)
Expand Down Expand Up @@ -366,7 +366,7 @@ async def get_versions():
f'nmdc-schema={version("nmdc_schema")}\n\n'
"<a href='https://microbiomedata.github.io/nmdc-runtime/'>Documentation</a>\n\n"
'<img src="/static/ORCIDiD_icon128x128.png" height="18" width="18"/> '
f'<a href="https://orcid.org/oauth/authorize?client_id={ORCID_CLIENT_ID}'
f'<a href="https://orcid.org/oauth/authorize?client_id={ORCID_NMDC_CLIENT_ID}'
"&response_type=code&scope=openid&"
f'redirect_uri={BASE_URL_EXTERNAL}/orcid_code">Login with ORCiD</a>'
" (note: this link is static; if you are logged in, you will see a 'locked' lock icon"
Expand Down

0 comments on commit beb2813

Please sign in to comment.