MetadataService does not support OAuth credentials properly
Nobody has claimed this yet.
- Dominant language
- Elixir
- Stars
- 296
- Forks
- 86
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 50
Description
Describe the bug
The MetadataService does not properly handle OAuth credentials and Keychain credentials. For OAuth credentials, it only uses the partial credential body (client_id, client_secret) but ignores the OAuth token data (access_token, refresh_token) stored in the separate oauth_token association. Additionally, OAuth tokens are not refreshed before use, potentially leading to expired token usage.
Version number
Current development version on branch 3359_keychain_credentials for Keychain Credentials, but main for regular credentials.
Discovered while reviewing https://github.com/OpenFn/lightning/pull/3451
To Reproduce
- Create a job with an OAuth credential
- Attempt to request metadata for the job via the Inspector
- The MetadataService will only receive the credential body (client_id,
client_secret) but not the OAuth token data (access_token, refresh_token) - Adaptor receives incomplete credential configuration
- For keychain credentials, the current fallback clause added in PR #3451
prevents errors but provides no meaningful functionality
Expected behavior
- OAuth credentials: Should use Lightning.Credentials.Resolver (once it's merged) credential + token data, with token refresh if needed
- Keychain credentials: Won't be supported since there is no dataclip context for resolution, #3451 address this with a fallback clause.
- Basic credentials: Should continue working as before
We really need to test this thoroughly, and hunt down any places that use a credentials body.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing MetadataService requests from the Inspector and inspect how credential bodies are passed to the adaptor. Read Lightning.Credentials.Resolver and the credential and oauth_token associations, then review PR #3451's fallback behavior. Done means basic credentials still work, OAuth token data is resolved and refreshed when needed, and the unsupported keychain case remains explicit and tested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elixir
- Domain
- authentication, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100