Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Question Hiding API keys proxy using UGS Authentication

Discussion in 'Authentication' started by NeptuneEarth, Jul 11, 2023.

  1. NeptuneEarth

    NeptuneEarth

    Joined:
    Dec 20, 2020
    Posts:
    15
    Hi there,
    I've searched for days. Is there any simple way to have authentication which gives token to the client app which then helps with calling functions that require API keys?

    I mean, the authentication part is simple nowadays, we just use Unity UGS, PlayFab, [you name it] and get access via the authtoken. But then, calling an API like OpenAI's ChatGPT with any of the cloud services proved to be hard for us game developers.
    We need to hide our API keys, so we obviously can't simply include the key in our games or client apps because then the API keys can easily be extracted by curious individuals!

    Any thoughts on this? Is there any simple way to use UGS and have it act like an API Proxy or something?
     
  2. erickb_unity

    erickb_unity

    Unity Technologies

    Joined:
    Sep 1, 2021
    Posts:
    100
    Hello,

    You can use Cloud Code (or any other intermediate backend function) to call external services that require a secret/api key, that way it is hidden from the client.
     
  3. NeptuneEarth

    NeptuneEarth

    Joined:
    Dec 20, 2020
    Posts:
    15
    Oh, thank you for the direction. I'll have a look.