Skip to content

Conversation

mikaroivainen
Copy link

This pull request adds support for the OAuth2 "client_credentials" flow to the backend and updates the UI to handle this new flow. The primary changes include backend logic for obtaining tokens using client credentials (without browser redirects), updating credential storage with token data, and frontend feedback for successful completion of the flow. The original "authorization code" flow remains unchanged.

OAuth2 flow enhancements:

  • Added backend support for the "client_credentials" grant type in packages/server/src/routes/oauth2/index.ts, enabling direct token acquisition and credential updates without browser redirects.
  • Updated credential data storage to include token information and expiry after successful token retrieval in the "client_credentials" flow.

Frontend improvements:

  • Modified AddEditCredentialDialog in packages/ui/src/views/credentials/AddEditCredentialDialog.jsx to detect when the "client_credentials" flow is complete (authorization URL is '#'), display a success message, and immediately confirm the credential without opening a new window.

Minor code cleanup:

  • Combined single-line object property assignment for finding credentials in the backend for readability.
  • Simplified scope parameter appending in the authorization URL construction.

@HenryHengZJ
Copy link
Contributor

thanks! which application/integration oauth2 uses client_credentials where I can test it out?

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