Skip to content

feat: replace api key with oauth2#24

Merged
leoparente merged 9 commits intoupdate_datamodelfrom
feat/OBS-889-oauth2
Apr 17, 2025
Merged

feat: replace api key with oauth2#24
leoparente merged 9 commits intoupdate_datamodelfrom
feat/OBS-889-oauth2

Conversation

@leoparente
Copy link
Copy Markdown
Contributor

This pull request introduces significant changes to the Diode SDK by replacing API key-based authentication with OAuth2 client credentials. The most important changes include updating environment variables, modifying the client structure and methods, and updating tests to reflect these changes.

Authentication Changes:

  • README.md: Updated environment variables to include DIODE_CLIENT_ID and DIODE_CLIENT_SECRET for OAuth2 authentication.
  • diode/client.go: Removed DIODE_API_KEY and added DIODE_CLIENT_ID and DIODE_CLIENT_SECRET environment variables.
  • diode/client.go: Replaced getAPIKey function with getClientID and getClientSecret functions to retrieve OAuth2 credentials.
  • diode/client.go: Added diodeAuthentication struct and methods to handle OAuth2 token fetching and updating client metadata.

Client Structure Changes:

  • diode/client.go: Updated GRPCClient struct to include clientID and clientSecret fields instead of apiKey.
  • diode/client.go: Modified NewClient function to initialize clientID and clientSecret instead of apiKey.

Test Updates:

Example Update:

  • examples/main.go: Updated example usage to include WithClientID and WithClientSecret instead of WithAPIKey.

@leoparente leoparente requested a review from jajeffries April 15, 2025 18:41
@leoparente leoparente self-assigned this Apr 15, 2025
@github-actions github-actions Bot added documentation Improvements or additions to documentation go markdown labels Apr 15, 2025
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 15, 2025

Go test coverage

STATUS ELAPSED PACKAGE COVER PASS FAIL SKIP
🟢 PASS 1.21s github.com/netboxlabs/diode-sdk-go/diode 20.0% 212 0 0

Total coverage: 92.6%

Comment thread diode/client.go
@leoparente leoparente marked this pull request as ready for review April 17, 2025 13:54
Copy link
Copy Markdown
Member

@mfiedorowicz mfiedorowicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🙇 , one cov related question

Comment thread Makefile
@leoparente leoparente merged commit 81176eb into update_datamodel Apr 17, 2025
3 checks passed
@leoparente leoparente deleted the feat/OBS-889-oauth2 branch April 17, 2025 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation go internal markdown

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants