Skip to content

Commit

Permalink
remove old orcid endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
PeopleMakeCulture committed Jan 20, 2024
1 parent d06e912 commit 6efb34c
Showing 1 changed file with 0 additions and 39 deletions.
39 changes: 0 additions & 39 deletions nmdc_runtime/api/endpoints/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,45 +72,6 @@ async def receive_orcid_code(request: Request, code: str, state: str | None = No
return response


@router.get("/orcid_authorize")
async def orcid_authorize():
"""NOTE: You want to load /orcid_authorize directly in your web browser to initiate the login redirect flow."""
return RedirectResponse(
f"https://orcid.org/oauth/authorize?client_id={ORCID_CLIENT_ID}"
"&response_type=token&scope=openid&"
f"redirect_uri={BASE_URL_EXTERNAL}/orcid_token"
)


@router.get("/orcid_token")
async def redirect_uri_for_orcid_token(req: Request):
"""
Returns a web page that will display a user's orcid jwt token for copy/paste.
This route is loaded by orcid.org after a successful orcid user login.
"""
return HTMLResponse(
"""
<head>
<script>
function getFragmentParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\#&]" + name + "=([^&#]*)"),
results = regex.exec(window.location.hash);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
</script>
</head>
<body>
<main id="token"></main>
</body>
<script>
document.getElementById("token").innerHTML = getFragmentParameterByName("id_token")
</script>
"""
)


@router.post("/token", response_model=Token)
async def login_for_access_token(
form_data: OAuth2PasswordOrClientCredentialsRequestForm = Depends(),
Expand Down

0 comments on commit 6efb34c

Please sign in to comment.