diff --git a/oauth3.node.storage.js b/oauth3.node.storage.js index 22ee06b..370c678 100644 --- a/oauth3.node.storage.js +++ b/oauth3.node.storage.js @@ -9,6 +9,11 @@ var sessionsdir = path.join(oauth3dir, 'sessions'); var directivesdir = path.join(oauth3dir, 'directives'); var metadir = path.join(oauth3dir, 'meta'); +// We can reasonably assume the existence of the home directory, but we can't assume +// that there will already be a `.oauth3` directory or anything inside of it. +if (!fs.existsSync(path.join(oauth3dir, '..'))) { + fs.mkdirSync(path.join(oauth3dir, '..')); +} if (!fs.existsSync(oauth3dir)) { fs.mkdirSync(oauth3dir); }