Is there a way to get the user's Airtable API key from a block?

We’re using both Airtable Apps (Blocks) as well as the Airtable API. Is there any way to get the user API key from a block? That way we avoid forcing the user to look for their API key and paste it into our app.

I’m hoping for something like this:

import {session} from '@airtable/blocks';

if (session.currentUser !== null) {
    console.log("The current user's API key is", session.currentUser.apiKey);
}

Hi @fintable! This isn’t currently possible in the apps SDK.

For some more context here: we’re unlikely to ever expose the users API key in the apps SDK as their API key gives access to bases other than the one the app is installed in. We might add some other form of API access for apps in the future though! I’d love to hear more about your use-case to help inform our prioritization: what are you using the API for? How does it integrate with your app?

Ah thanks, no worries, I’ll just ask our users to paste in their Airtable API key then. I understand that is asking for a different level of access, so it makes sense to get the user’s explicit permission again.

As for the kind of integration I’m building, our website at https://fintable.io is pretty self-explanatory.

The reason we use both Apps and API is because our integration runs mostly in the background, a sort of daily sync with no user intervention. For background syncing, we need the API. However we also use Airtable Apps to make the whole onboarding process smoother, although we don’t strictly need to use an Airtable App for that.

Oh, super cool! Thanks for sharing. Looking forward to seeing your app submission :smiley:

This topic was solved and automatically closed 15 days after the last reply. New replies are no longer allowed.