Add File Picker Support To OAuth Credentials
Open
Nobody has claimed this yet.
credentials
feature enhancement
- Dominant language
- Elixir
- Stars
- 296
- Forks
- 86
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 50
Description
Overview
Enhance our Generic OAuth credential component to support file picker for OAuth clients that use restrictive scopes (like drive.file). This requires users to explicitly select which files their credentials can access, as these scopes don't grant broad file access.
Motivation
Some OAuth providers offer restrictive scopes that only allow access to user-selected files (e.g., Google's drive.file scope). Our Generic OAuth implementation needs to support file pickers for these clients, as the credentials won't function without explicit file authorization.
Technical Requirements
OAuth Client Configuration
- Add
requires_file_pickerboolean tooauth_clientstable - Add
file_picker_configJSON field to store picker configuration (mime types, view options, etc.) - Update
OauthClientschema and changeset
Backend Changes
- Add
authorized_resourcesfield tooauth_tokenstable - Update
OauthTokenschema to handle authorized resources - Create helpers for managing authorized resources in
Lightning.Credentials - Add validation to ensure at least one file is authorized for restrictive scopes
GenericOauthComponent Updates
- Check if selected OAuth client has
requires_file_pickerenabled - When enabled, show authorized files section after successful OAuth
- Make file selection mandatory before credential can be saved
- Add "Select Files" button that launches appropriate picker based on provider
- Implement remove functionality for individual files
- Handle picker events and update authorized resources
- Show warning if no files are selected
Frontend Implementation
- Create provider-agnostic file picker JS hook that can work with different providers
- Start with Google Picker implementation as first provider
- Structure to easily add other providers (Dropbox Chooser, OneDrive Picker, etc.)
UI Flow
- User selects OAuth client in credential form
- Completes OAuth flow as normal
- If client requires file picker:
Authorized Files (Required) This credential uses restricted access and requires you to select specific files. ⚠️ No files selected - credential cannot be used until files are authorized [Select Files] - After selecting files:
Authorized Files: 3 selected ✓ Monthly Report.xlsx [Remove] ✓ Patient Records.xlsx [Remove] ✓ Budget Tracker.xlsx [Remove] [+ Add More Files] - Credential can only be saved once at least one file is selected
Implementation Notes
- File picker is REQUIRED for OAuth clients with restrictive scopes
- Credentials without authorized files won't work with restrictive scopes
- Each provider may have different picker implementations
- Authorized resources are stored in the oauth_token, not the credential
- Clear error states when no files are selected
Questions to Resolve
- How to handle when authorized files are deleted/renamed on provider side?
- Should we support folder-level authorization for providers that allow it?
- What happens to existing workflows when files are removed from authorization?
- Should we show which workflows use which authorized files?
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.
Assessment
This issue has not been assessed yet.