Skip to content

Commit

Permalink
add logs to debug broken ORCID login
Browse files Browse the repository at this point in the history
  • Loading branch information
vemonet committed Nov 1, 2023
1 parent 04c76a8 commit 04922de
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
4 changes: 3 additions & 1 deletion backend/app/api/nanopub.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ def get_np_config(user_id: str) -> NanopubConf:
@router.post(
"/assertion",
name="Publish an Assertion",
description="""Post an RDF assertion as JSON-LD (only triples, no graph) that will be published in a Nanopublication using the key previously stored with your ORCID user""",
description="""Post an RDF assertion as JSON-LD that will be published in a Nanopublication using the key previously stored with your ORCID user.
You can also provide additional provenance using the special `@provenance` key.""",
response_description="Operation result",
response_model={},
)
Expand All @@ -91,6 +92,7 @@ async def publish_assertion(
) -> Response:
nanopub_rdf = jsonable_encoder(nanopub_rdf)

print(current_user)
if not current_user or "id" not in current_user.keys():
raise HTTPException(
status_code=403,
Expand Down
11 changes: 7 additions & 4 deletions backend/app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
import secrets
from typing import Optional, Union

from pydantic import BaseSettings, validator
from pydantic import validator, BaseSettings
# from pydantic_settings import BaseSettings
# from pydantic_settings import BaseSettings, SettingsConfigDict


class Settings(BaseSettings):
Expand All @@ -11,7 +13,7 @@ class Settings(BaseSettings):
STAGING_URL: str = "https://collaboratory-api.ci.transltr.io"
DEV_URL: str = "https://api.collaboratory.semanticscience.org"

VIRTUAL_HOST: str = None
VIRTUAL_HOST: Optional[str] = None

BIOLINK_VERSION: str = "3.1.0"
TRAPI_VERSION: str = "1.4.0"
Expand All @@ -23,8 +25,8 @@ class Settings(BaseSettings):
# The settings used by Docker deployment are in the .env file
PROJECT_NAME: str = "Knowledge Collaboratory API"
DATA_PATH: str = "/data"
KEYSTORE_PATH: Optional[str]
NER_MODELS_PATH: Optional[str]
KEYSTORE_PATH: str = "./nanopub-keystore"
NER_MODELS_PATH: str = "./ner-models"

NANOPUB_GRLC_URL: str = "https://grlc.np.dumontierlab.com/api/local/local"
NANOPUB_SPARQL_URL: str = "https://virtuoso.nps.petapico.org/sparql"
Expand Down Expand Up @@ -72,6 +74,7 @@ def assemble_cors_origins(cls, v: Union[str, list[str]]) -> Union[list[str], str
class Config:
case_sensitive = True
env_file = ".env"
# model_config = SettingsConfigDict(env_file=".env", env_file_encoding='utf-8')

def __init__(
self,
Expand Down
4 changes: 2 additions & 2 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ dependencies = [
"python-multipart >=0.0.5",
"requests >=2.23.0",
"httpx >=0.21.1",
"pydantic[dotenv] >=1.9",
"pydantic[dotenv] <2.0.0", # reasoner-pydantic not updated to v2 https://github.com/TranslatorSRI/reasoner-pydantic/issues/63
# "pydantic-settings",
"fastapi >=0.68.1",
"uvicorn >=0.15.0",
"gunicorn >=20.0.4",
"Authlib >=0.15.4",
"itsdangerous >=2.0.1",
"reasoner-pydantic >=2.2.3",
# "reasoner-pydantic ==3.0.1",
# TODO: we can remove kgx once poetry finally manage to find 3.1.5
# "kgx >=1.6.0",
"rdflib >=6.1.1",
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/PublishNanopubButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ const PublishNanopubButtons = ({
requestParams['source'] = inputSource
}
const access_token = user['access_token']
console.log(user)
axios
.post(`${$userSettings.api}/assertion`, stmtJsonld, {
headers: {Authorization: `Bearer ${access_token}`},
Expand Down
1 change: 1 addition & 0 deletions frontend/src/pages/about.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ApiIcon from '@mui/icons-material/Storage'
import SearchIcon from '@mui/icons-material/Search'
import PublishIcon from '@mui/icons-material/Outbox'


export default function About() {
const theme = useTheme()
const [state, setState] = React.useState({
Expand Down

0 comments on commit 04922de

Please sign in to comment.