Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Key Not Saving in Keychain - OpenAI Chat Extension #1252

Open
peixinshen opened this issue Aug 23, 2024 · 8 comments
Open

API Key Not Saving in Keychain - OpenAI Chat Extension #1252

peixinshen opened this issue Aug 23, 2024 · 8 comments
Labels

Comments

@peixinshen
Copy link

Thank you for developing and maintaining this great extension!

I am using the "OpenAI Chat" extension with PopClip on MacOS Sequoia 15.1. Since the 2024-05-17 update (v133), where the API key is stored in the keychain, the API key cannot save properly. After entering the key in the settings, it appears blank when reopened. Using this extension warns:
Message from OpenAl (code 401): You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth.
I tried to revert the API key type from "secret" back to "string" in Config.ts and found that it resolved the issue.

Could this be a bug, or am I missing the correct way to store the API key in the keychain? Thanks for your help!

@Florianismeandonlyme
Copy link

Same Problem

@ziegn
Copy link

ziegn commented Oct 16, 2024

When I revert the API key type in Config.ts to string, I can't start this extension. My version of the extension is 244.

@pilotmoon
Copy link
Owner

This one is currently a mystery to me. I don't think it is an issue with the extension but rather it seems PopClip may be having a problem saving to the keychain on some people's machines. As an initial step to gather information about the problem, I've added an alert dialog when a keychain action fails in PopClip 2024.12 (released today). If you see such an alert, please let me know the error message details.

@pilotmoon
Copy link
Owner

When I revert the API key type in Config.ts to string, I can't start this extension. My version of the extension is 244.

If you're editing an extension you'll need to also change the identifier so that is does not start with com.pilotmoon. -- then is should start OK. If any trouble please let me know the specifi eror or whatever (in a different issue, or an email)

@pilotmoon pilotmoon added the bug label Dec 20, 2024
@peixinshen
Copy link
Author

This one is currently a mystery to me. I don't think it is an issue with the extension but rather it seems PopClip may be having a problem saving to the keychain on some people's machines. As an initial step to gather information about the problem, I've added an alert dialog when a keychain action fails in PopClip 2024.12 (released today). If you see such an alert, please let me know the error message details.

Thanks for the update! Here is the error that popped up in PopClip 2024.12.

Keychain Error
Function : Secltem Add , Error code : -34018 , DP : 1 , Sync : 0 , Service : com.pilotmoon.popclip , Identifier : extension # com.pilotmoon.popclip.exten-
sion.chatgpt # apikey , DataLen : 56

@pilotmoon
Copy link
Owner

pilotmoon commented Dec 25, 2024

Thank you.

That error -34018 is errSecMissingEntitlement. Something to do with entitlements and code signing.

Are you using a cracked version of PopClip?

@peixinshen
Copy link
Author

Thank you.

That error -34018 is errSecMissingEntitlement. Something to do with entitlements and code signing.

Are you using a cracked version of PopClip?

Now I have completely reinstalled the licensed version of PopClip. Everything works perfectly: the API key can be saved without any warnings. Thank you very much for developing and maintaining this excellent extension!

@pilotmoon
Copy link
Owner

That's great. Yes, a clean reinstall should solve it. If there is any modification or damage to the PopClip.app package, that will prevent macOS verifying the app signature and it won't allow it to access the secure keychain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants