Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: introduce oauth configs into IR, Fern def and OAS extensions #3373

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

armandobelardo
Copy link
Collaborator

@armandobelardo armandobelardo commented Apr 14, 2024

The general idea here is to allow the SDKs to generate helper methods for oauth. We're taking different paths for the different types of oauth:

  • Client credentials
  • Access code
    • Since this flow typically requires a user to get a short lived access code prior to requesting an access token and refresh token we'd limit this to static helpers:
      • A static helper to generate the authorization URL, the URL a user visits to get the access code, this URL is just constructed by us leveraging the details held within authorization-endpoint
      • A static helper to get the access token from the access code
      • A static helper to refresh a token and get a new access + refresh token
      • If you want to go the extra mile, you could make an object-oriented AccessToken object that takes in the access code with a .get and .refresh token that handle this for the user

path:
type: string
docs: The path to append to the base URL to get the authorization endpoint a user is meant to visit within the browser.
queryParameters: optional<list<OauthAuthorizationEndpointParameters>>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Given that the property is named queryParameters, should we just use http.QueryParameter here instead of defining OauthAuthorizationEndpointParameters?

  QueryParameter:
    extends: commons.Declaration
    properties:
      name: commons.NameAndWireValue
      valueType: types.TypeReference
      allowMultiple: boolean

union:
authorizationCode: AuthorizationCodeOAuthScheme
clientCredentials: ClientCredentialsOAuthScheme
OauthAccessTokenFields:
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: Maybe best to standardize on either OAuth* or Oauth. I prefer OAuth*, but fine with either way.

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

Successfully merging this pull request may close these issues.

None yet

2 participants