How to Migrate from ChatGPT Plugins to Actions: Solving OAuth Failures

How to Migrate ‘Plugins’ Without Authentication
I’ve had multiple failed attempts at migrating from “Plugins” to “Actions,” so I want to share a successful method with you. With “Actions,” the “ai-plugin.json” file has been removed, which means you’ll need to substitute the information that was previously provided by it.

“Plugins” that use OAuth no longer work.
Since “ai-plugin.json” has been removed, the “authorization_content_type” is also gone. The request body sent to the /token endpoint used to be “application/json,” but it has been changed to “application/x-www-form-urlencoded,” causing the plugins to malfunction. We need to address this issue.

5 Likes

This sounds like a rational cause for my own issues in this area. Any ideas how to manage?

Thought it might help to clarify what my own issue is. I attempted to just import the openapi.yaml and that cause an issue until i added that new field. Now it fails to properly use the plugin, even though when in the plugin chats it works perfect each time. As seen below:

Yet, when i attempt to use it inside the GPT where I imported it as an Action it sends an empty json string.

1 Like

I experienced the authorization-content-type mismatch as well.
The ‘normal’ plugin still works. But trying to get it working as an action:

I got 422 validation errors on the token endpoint, which turned out to be caused by not receiving json but formdata. Unsure though what formdata should be accepted / if there still is grant_type = authorization_code or refresh_token etc. Could not find updated docs as well.

@yhavinga @inu-ai are yall suggesting you are able to get some portion of oauth working on GPTs actions? If so how?

Given how you cannot pass in the ai-plugin.json auth content I don’t see how to get it to work. In fact I don’t know how to get any auth to work in actions.

The image is a screenshot from my ChatFeedSync Plugins where I managed to temporarily migrate to Actions.
Here is an excerpt of the modified code:
It involves a method to determine if the “Content-Type” header is “application/json” and change the parsing method accordingly.
This code uses the TypeScript hono library, but I hope the content is clear.

interface OpenAIOAuthTokenRequest {
  grant_type: "authorization_code" | "refresh_token";
  client_id: string;
  client_secret: string;
  code?: string;
  redirect_uri?: string;
  refresh_token?: string;
}

app.post("/v1/oauth/token", async (c: Context) => {
  try {
    const content_type = c.req.header("Content-Type");
    const {
      grant_type,
      client_id,
      client_secret,
      code,
      redirect_uri,
      refresh_token,
    } = (await (content_type === "application/json"
      ? c.req.json()
      : c.req.parseBody())) as OpenAIOAuthTokenRequest;

Below is the GPTs that have been successfully migrated to Actions.
ChatFeedSync:

1 Like

Is there an OAI guide to migrate plug into actions with authentication?

Not currently. I wouldn’t say it’s particularly difficult, the upshot is:

  1. Anything that used to be in ai-plugin.json is configurable through the UI (including authentication; it seems like this was added after this post & the initial release)
  2. You can import your existing schema directly.
  3. Localhost plugins are temporarily disabled, and there seem to be slightly tighter restrictions on what domains you can use (YMMV here, not everything is documented)

Their docs explain the main differences in schemas but I believe the OpenAPI schema should be fully backwards compatible.

1 Like

Thanks for answering the question. It will be nice OpenAI team or someone can build a GPT-4 based tool for the migration effort :slight_smile: