Skip to content

Fetch API key from stash server configuration#4

Open
xmapdev wants to merge 1 commit intothismanyboyfriends2:mainfrom
xmapdev:fix/fetch-api-key
Open

Fetch API key from stash server configuration#4
xmapdev wants to merge 1 commit intothismanyboyfriends2:mainfrom
xmapdev:fix/fetch-api-key

Conversation

@xmapdev
Copy link
Copy Markdown
Contributor

@xmapdev xmapdev commented Feb 16, 2026

Fixes an issue where the application does not include an API key in the connection fragment given to the plugin upon initialization, but still requires an API key for authentication with the GraphQL endpoint.

In this case, a session cookie is provided instead. However, the GraphQL client and wrapper does not support authenticating via cookies. Subsequent calls to the GraphQL endpoint fails with an 401 Unauthorized error since no API key is provided.

This commit adds a helper function that retrieves the API key using StashInterface from stashapi.stashapp, which supports any authentication method provided in the server connection fragment given to the plugin. The key is then passed in subsequent calls to the application. This package should already be present due to the plugin depending on stashapp-tools.

Attached is a log file showing the error raised when an API key is missing from the initial configuration fragment passed to the plugin.

out.log

Fixes an issue where the application does not include an API key in the
connection fragment given to the plugin upon initialization, but still
requires an API key for authentication with the GraphQL endpoint.

In this case, a session cookie is provided instead. However, the GraphQL
client and wrapper does not support authenticating via cookies. In this
scenario, subsequent calls to the GraphQL endpoint fails since no API
key is provided.

This commit adds a helper function that is used to retrieve the API key
if it is missing from the connection fragment upon plugin load. The API
key is then used in subsequent calls to the application.
@l34240013
Copy link
Copy Markdown

Thanks for this patch @xmapdev I found it useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants