The commonly recommended approach is to use an OAuth procedure: https://platform.openai.com/docs/plugins/authentication
I haven't yet done this myself, but maybe the links from above will help you solving the issue.
Also, have you tried asking ChatGPT itself?