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

Support auth reference id OpenAPI extension #6196

Open
samwelkanda opened this issue Feb 24, 2025 · 0 comments · May be fixed by #6214
Open

Support auth reference id OpenAPI extension #6196

samwelkanda opened this issue Feb 24, 2025 · 0 comments · May be fixed by #6214
Assignees
Labels
type:feature New experience request WIP
Milestone

Comments

@samwelkanda
Copy link
Contributor

samwelkanda commented Feb 24, 2025

Is your feature request related to a problem? Please describe the problem.

Kiota does not recognize the OpenAPI extension for authentication vault reference id within the securityScheme object in OAS files. This value is required in the runtime object entry for copilot api plugins.

Client library/SDK language

None

Describe the solution you'd like

Kiota needs to support reading the x-ai-auth-reference-id OpenAPI extension in OAS files and writing to the runtime object of the plugin manifest.

Sample OAS file:

paths:
  /users:
    get:
      operationId: getUsers
      parameters: []
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/User'
      security:
        - GraphOAuth2AuthAppOnly:
            - user.read.all
  /users/{id}:
    get:
      operationId: getUser
      parameters:
        - name: id
          in: path
          required: true
          description: The user id
          schema:
            type: string
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
      security:
        - GraphOAuth2AuthDelegated:
            - user.read
security:
  - GraphOAuth2AuthDelegated:
      - user.read
components:
  schemas:
    User:
      type: object
      required:
        - id
        - displayName
      properties:
        id:
          type: string
        displayName:
          type: string
  securitySchemes:
    GraphOAuth2AuthDelegated:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://login.microsoftonline.com/tenantid/oauth2/v2.0/authorize
          tokenUrl: https://login.microsoftonline.com/tenantid/oauth2/v2.0/token
          scopes:
            user.read: Grants read access to the signed-in user's profile
      x-ai-auth-reference-id-: 'someValue789'
    GraphOAuth2AuthAppOnly:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://login.microsoftonline.com/tenantid/oauth2/v2.0/token
          scopes:
            user.read.all: Grants read access to all users' full profiles
      x-ai-auth-reference-id-: 'otherValue123'

Expected plugin manifest:

"functions": [
    {
      "name": "getUser"
    },
    {
      "name": "getUsers"
    }
  ],
  "runtimes": [
    {
      "type": "OpenApi",
      "auth": {
        "type": "OAuthPluginVault",
        "reference_id": "someValue789"
      },
      "spec": {
        "url": "msgraphusers-openapi.yml"
      },
      "run_for_functions": [
        "getUser"
      ]
    },
    {
      "type": "OpenApi",
      "auth": {
        "type": "OAuthPluginVault",
        "reference_id": "otherValue123"
      },
      "spec": {
        "url": "msgraphusers-openapi.yml"
      },
      "run_for_functions": [
        "getUsers"
      ]
    }
  ]

Additional context

No response

@samwelkanda samwelkanda added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:feature New experience request labels Feb 24, 2025
@samwelkanda samwelkanda added this to the Kiota v1.24 milestone Feb 24, 2025
@samwelkanda samwelkanda self-assigned this Feb 24, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage 🔍 in Kiota Feb 24, 2025
@baywet baywet removed the status:waiting-for-triage An issue that is yet to be reviewed or assigned label Feb 24, 2025
@baywet baywet moved this from Needs Triage 🔍 to In Progress 🚧 in Kiota Feb 24, 2025
@baywet baywet moved this from In Progress 🚧 to New📃 in Kiota Feb 24, 2025
@samwelkanda samwelkanda linked a pull request Feb 27, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New experience request WIP
Projects
Status: New📃
Development

Successfully merging a pull request may close this issue.

2 participants