Skip to content
This repository was archived by the owner on Jan 20, 2024. It is now read-only.

Commit 78b8247

Browse files
committed
Allow each option to be an object
1 parent c1e5968 commit 78b8247

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

client-oauth2.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -320,13 +320,15 @@
320320
* @return {Object}
321321
*/
322322
ClientOAuth2.prototype.createToken = function (access, refresh, type, data) {
323-
data = assign({}, data, {
324-
access_token: access,
325-
refresh_token: refresh,
326-
token_type: type
327-
})
328-
329-
return new ClientOAuth2Token(this, data)
323+
var options = assign(
324+
{},
325+
data,
326+
typeof access === 'string' ? { access_token: access } : access,
327+
typeof refresh === 'string' ? { refresh_token: refresh } : refresh,
328+
typeof type === 'string' ? { token_type: type } : type
329+
)
330+
331+
return new ClientOAuth2Token(this, options)
330332
}
331333

332334
/**

0 commit comments

Comments
 (0)