Skip to content
This repository has been archived by the owner on Dec 30, 2021. It is now read-only.

Commit

Permalink
feat(setaccesstoken): adding a new method setAccessToken to set the a…
Browse files Browse the repository at this point in the history
…ccess token externally

This feature will allow users to authenticate outside of the imgur package.
  • Loading branch information
KenEucker committed Mar 9, 2021
1 parent 7238312 commit a5ac3d2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/imgur.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,17 @@ imgur._getAuthorizationHeader = async () => {
return `Bearer ${imgurAccessToken}`;
};

/**
* Set your Authorization if authenticating separately
* @link https://api.imgur.com/#register
* @param {string} accessToken
*/
imgur.setAccessToken = function (accessToken) {
if (accessToken && typeof accessToken === 'string') {
imgurAccessToken = accessToken;
}
};

/**
* Set your credentials
* @link https://api.imgur.com/#register
Expand Down

0 comments on commit a5ac3d2

Please sign in to comment.