Oauth unique identifier for making requests to server / track usage of api calls

I’m using google Oauth to have users sign in when they install the plugin. My goal is for each user to get 3 free api calls, and then after those have their unique identifier updated so that they can only be returned a response pushing them to a paid subscription page.

Once there, if they subscribe their account will be labeled as subscriber and they can call as many times as they please.

I’m using Google Firestore for the database.

Currently I can install the plugin
I’m rerouted to oauth to sign in
It takes me back to ChatGPT w/ plugin installed
I can call my plugin

The problem is each time I call the plugin it creates a new user in my Firestore database. So if I want to limit usage to 3 calls, I can’t track it b/c each call creates a new user w/ 0 calls.

Has anyone had luck connecting Oauth tokens to a unique identifier in chatGPT to track usage of users? I’m new to database stuff so any help is appreciated!

Hey!

I wonder if our authentication at PluginLab could do the job for you.

You could signup your users using the PluginLab no-code interface.

Then PluginLab will forward a fresh idToken every time a user makes a request.

You can verify the idToken using the NodeSDK @pluginlab/node-sdk - npm and also sync your users into firebase using our Webhooks.

Let me know if I can help :slight_smile:

www.pluginlab.ai

2 Likes