Skip to main content

I can't get Block SDK to work with Personal Access Tokens. It doesn't accept the format and returns...

Error: ❌ Invalid Airtable API key specified. Make sure you copied it correctly from airtable.com/account.
Code: airtableApiKeyMalformed

@Olafur_Petursso: I saw your post from a few weeks ago and adding the secret key seemed to work for you. You do mean this key, correct?

Any help is highly appreciated! 

 

Is this during `block init`?  If so, I vaguely recall hitting something similar; ended up solving it by just making a PAT with access to everything with all workspaces forever heh

And yeap I used that key; lemme know if you're still facing issues with a key that has access to everything and I'll run some tests


@TheTimeSavingCo Thank you! This is happening for 'block set-api-key' and also on 'block submit'. I've tried using a PAT with access to everything, but that didn't solve it. I feel that there is a validator inside of the Blocks SDK that isn't allowing the PAT format and still relies on the old API key format. Setting legacy API keys still works via 'set-api-key', but fails when submitting.

I've reached out to AT support.


@TheTimeSavingCo Thank you! This is happening for 'block set-api-key' and also on 'block submit'. I've tried using a PAT with access to everything, but that didn't solve it. I feel that there is a validator inside of the Blocks SDK that isn't allowing the PAT format and still relies on the old API key format. Setting legacy API keys still works via 'set-api-key', but fails when submitting.

I've reached out to AT support.


Weird!  I just created a new PAT with only block scopes and access to current and future workspaces.  I then did a `block set-api-key` and it saved it fine

Let me know if I can test anything to help!


Tried the same again (hadn't used "access to current and future workspaces" before), but with no luck. What's your blocks version in package.json?

 


Tried the same again (hadn't used "access to current and future workspaces" before), but with no luck. What's your blocks version in package.json?

 


Here!

CLI:

@airtable/blocks-cli/2.0.4 darwin-x64 node-v19.5.0

 


Puh, realized I was still using an old version of the Blocks CLI. Played around with Node.JS versions and eventually managed to update. Now all is working! Thanks for your support and sharing!!


Puh, realized I was still using an old version of the Blocks CLI. Played around with Node.JS versions and eventually managed to update. Now all is working! Thanks for your support and sharing!!


Ahh yeah, been there man.  Glad you got it sorted!


If you've already tried a PAT with only block scopes and access to current and future workspaces and it still isn't working you may want to open a support ticket with Airtable directly!


Have you checked your Block CLI version? Not updating that caused the issue for me (had to play with Node versions a bit as far as I remember)


Reply