Skip to content

Conversation

@vera
Copy link

@vera vera commented Nov 4, 2025

What this PR does / why we need it:

This PR adds a config setting bearerTokenGetFunction to define a custom function to retrieve the bearer token. This is more flexible than the current bearerTokenLocalStorageKey setting.

Which issue(s) this PR closes:

Related Dataverse PRs:

/

Special notes for your reviewer:

/

Suggestions on how to test this:

I've tested this by initializing with the following config:

ApiConfig.init(
  "http://localhost:8080/api",
  DataverseApiAuthMechanism.BEARER_TOKEN,
  undefined,
  undefined,
  () => {
    const value = localStorage.getItem("oidc.default");
    if (value) {
      const token = JSON.parse(value).tokens?.accessToken;
      return token || null;
    } else {
      return null;
    }
  }
);

and confirmed that bearer-token-authenticated requests are correctly sent.

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

Yes, that would be good.

Additional documentation:

/

@pdurbin pdurbin moved this to Ready for Triage in IQSS Dataverse Project Nov 4, 2025
@scolapasta scolapasta moved this from Ready for Triage to Ready for Review ⏩ in IQSS Dataverse Project Nov 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready for Review ⏩

Development

Successfully merging this pull request may close these issues.

Feature request: custom config for retrieving bearer token

1 participant