Plugin Oauth error: "Error getting system message: {"message": "User is missing credentials"}"

I’m also running into an issue where my plugin stops working after about 24 hours or so. I think I did not set up Google’s Auth correctly and I need to make /auth and /token endpoints on my backend rather than calling Google directly.

Ah I realized the issue I think. ChatGPT does not include access_type=offline, so Google does not return a refresh token. Trying to think of what to do to work around that.

Update: I worked around it by implementing an /auth and /token endpoint, and in my auth endpoint I added access_type: "offline" to the search params.

You can see the implementation here: smart-playlist-generator/auth.js at main · AustinMichaelColeman/smart-playlist-generator · GitHub

I’m using Vercel serverless functions to deploy it. It’s a Smart Playlist Generator plugin for ChatGPT and for YouTube Music. Not yet publicly available but I feel pretty close.

It’s possible I still didn’t implement auth correctly, if anyone knows better or needs help feel free to reach out.

Update:

I realized that in order for a refresh token to be returned from the endpoint, you have to revoke the permissions for your app if you previously had authorized it without passing “access_type”:“offline” in the parameters: https://myaccount.google.com/permissions

So actually maybe my /auth and /token endpoints are working, I just needed to revoke the permissions on my end so that Google sends a new refresh token. I just tested it and now Google does return a refresh token.

One more thing I forgot to do that I just fixed: my /token ends point needed to handle both grant_type === “authorization_code” and grant_type === “refresh_token”:

I think it’s working now

3 Likes