From 7933726465b2d155a59f608f4d123abeb5384269 Mon Sep 17 00:00:00 2001 From: Gregory Goijaerts Date: Tue, 21 Feb 2017 11:46:41 +0100 Subject: [PATCH] allow manually setting an access token --- lib/imgur.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/imgur.js b/lib/imgur.js index 1d6423bb..1672422c 100644 --- a/lib/imgur.js +++ b/lib/imgur.js @@ -311,6 +311,25 @@ imgur.getAPIUrl = function() { return IMGUR_API_URL; } + +/** + * Set Imgur Access Token + * @param {string} URL - URL to make the API calls to imgur + */ +imgur.setAccessToken = function(ACCESS_TOKEN) { + if(ACCESS_TOKEN && typeof ACCESS_TOKEN === 'string') { + IMGUR_ACCESS_TOKEN = ACCESS_TOKEN; + } +} + +/** + * Get Imgur API Url + * @returns {string} API Url + */ +imgur.getAccessToken = function() { + return IMGUR_ACCESS_TOKEN; +} + /** * Set Mashape Key * @link https://market.mashape.com/imgur/imgur-9