Skip to content

feat: add sign-up and ORCID-at-sign-up use cases - #502

Draft
ChengShi-1 wants to merge 1 commit into
developfrom
builtin-user-signup-and-orcid
Draft

ChengShi-1 wants to merge 1 commit into
developfrom
builtin-user-signup-and-orcid

Conversation

@ChengShi-1

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Adds use cases for the new sign-up API, so the modern UI (and other clients) can let new users create a builtin account and optionally connect their ORCID iD while signing up.

  • signUp calls POST /users/signup without authentication and creates a builtin user.
  • getOrcidSignUpAuthorizationUrl calls GET /users/signup/orcid/authorize and returns the ORCID URL to send the user to.
  • connectOrcidForSignUp calls POST /users/signup/orcid with the code and state ORCID returns. It gives back the ORCID iD, the details to pre-fill the form with, and the orcidToken to include in signUp.
  • AuthenticatedUser has an optional authenticatedOrcid.
  • ReadError and WriteError now expose the HTTP statusCode and, when the API returns them, per-field fieldErrors. That lets a form show validation errors next to the right fields.
  • ApiRepository.doPost takes an optional authRequired argument (default true), so a request can be sent without the configured credentials.

This replaces 3f94643b, which was pushed to develop by mistake and is being reverted in #501.

Which issue(s) this PR closes:

  • Closes #

Related Dataverse PRs:

Special notes for your reviewer:

Suggestions on how to test this:

  1. Unit tests: npm run test:unit.
  2. Integration tests (need a Dataverse image built from Add a sign-up API for the modern UI, with optional ORCID iD dataverse#12858): set DATAVERSE_IMAGE_TAG in test/environment/.env to that image, then run npm run test:integration.
  3. The ORCID use cases need an ORCID sandbox client, so the integration tests only cover the cases that don't reach ORCID, such as ORCID not being configured.

Is there a release notes or changelog update needed for this change?:

Yes, added under "Unreleased" in CHANGELOG.md.

Additional documentation:

The three new use cases are documented in docs/useCases.md.

Adds SignUp, GetOrcidSignUpAuthorizationUrl and ConnectOrcidForSignUp for
POST /users/signup, GET /users/signup/orcid/authorize and
POST /users/signup/orcid, which are called without authentication.
AuthenticatedUser gains authenticatedOrcid.

ReadError and WriteError now carry the HTTP statusCode and the server's
fieldErrors, so clients can show validation errors next to form fields.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant