Forum Discussion
Using OpenAI from within Articulate Storyline - a working Story
In another thread Chris pointed out the open AI key was not secure.
To ally that concern please find attached revised versions of the story and the embedded functions globalScripts.js file that encrypt the open AI key in the browser. Transmission uses the https protocol thus ensuring the key is encrypted during network traversal.
- Jürgen_Schoene_2 years agoCommunity Member
your example is very good for testing and learning, but not for real use
NEVER use such functions for store the API key
function writeVal( key, value ){
const serializedData = localStorage.getItem( NAMESPACE );
const data = serializedData ? JSON.parse( serializedData ) : { };
data[ key ] = value;
localStorage.setItem( NAMESPACE, JSON.stringify( data ));
}
function readVal( key ) {
const serializedData = localStorage.getItem( NAMESPACE );
const data = JSON.parse( serializedData );
return( data ? data[ key ] : undefined );
}the API key is stored on the client computer (-> localStorage)
everyone (every learner) who as access to the course can copy the API key in seconds and use or sell it - you will pay for the 'illegal' usage
the only solution is to store the api key on a separate webserver (e.g. with node.js)
client browser <-> your webserver with the API key <-> openAI server