Yet another beautiful wrapped mikeal/request with OAuth 2.0 feature for Youku APIs.
npm install oauthic-youku
require'oauthic-youku'clientclientId: 'q298ajhzxkkp019cjzkoq01'clientSecret: '228bnzokjpasiodufc'redirectUri: ''credenticalcode// ...
var client = require'oauthic-youku'clientclientId: 'q298ajhzxkkp019cjzkoq01'clientSecret: '228bnzokjpasiodufc'tokenaccessToken expiresAtrefreshrefreshToken// saveToDb(refreshed)return nextexpired// log(token + ' has expired and could not be refreshed.')clientget'/videos/by_me'// ...
Create a new client instance.
Client, a wrapped mikeal/request instance.
Build the URL of the authorization page.
Get Access Token with an Authorization Code and get ready for making a request.
Set the Access Token.
Sets the Refresh Token and/or a handler that would be called when the Access Token is refreshed by the Refresh Token.
Registers a handler that would be called when the Access Token is expired and could not be refreshed.
Wrapped methods from mikeal/request. General parameters (e.g. access token) is added. URL could be written in short form, e.g.
Returns the current user's Access Token. Useful when you'd prefer building request parameters manually.
(The MIT License)
Copyright (c) 2013 XiNGRZ <firstname.lastname@example.org>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.