Skip to content

Example of how to authenticate to a backend within a widget #29

@airhorns

Description

@airhorns

The Apps SDK docs say:

If you already run an API or need multi-user collaboration, integrate with your existing storage layer. In this model:

Authenticate the user via OAuth (see Authentication) so you can map ChatGPT identities to your internal accounts.
Use your backend’s APIs to fetch and mutate data. Keep latency low; users expect components to render in a few hundred milliseconds.

This repo has an example of facilitating the OAuth dance, but, no examples of making authenticated API calls within a widget to the backend. What's the recommended pattern for authenticating those calls made from within the iframe? I know that MCP tool calls can be made with window.openai, but the docs seem to suggest we can also make plain old HTTP API calls within the client side JS -- how should we auth those?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions