Playlyfe Node SDK
Playlyfe API implementation in NodeJS. This module integrates seamlessly with the passport-playlyfe module for authentication support.
Visit the complete API reference
To learn more about how you can build applications on Playlyfe visit the official developer documentation
Install
To get started simply run
npm install playlyfe-node-sdk
Synopsis
express = ;Playlyfe = // Put in your application details here.var config = type: 'code' // The type of OAuth2.0 flow we wish use client_id: 'YOUR CLIENT ID' client_secret: 'YOUR CLIENT SECRET' redirect_uri: 'https://localhost:8080/auth/redirect'; client = config; app = ;app;app;app;app;app;app; var { if reqsessionlogged_in return ; else return res; }; // start playlyfe oauth authorization code flowapp; // get access token and save itapp; // Proxy requests to playlyfe server.// We keep the access token away from cheaters by using the authorization code flow.appall'/api/*' auth { res; res; res; client;}; app; app;
Methods
constructor (options)
The options object contains the configuration options for your playlyfe application. These values can be found in the clients menu in the game builder on the Playlyfe Platform.
{
type: 'OAUTH_2.0_FLOW_TYPE' // Must be either code or client
clientID: 'YOUR_CLIENT_ID',
clientSecret: 'YOUR_CLIENT_SECRET',
redirectURI: 'REDIRECT_URI' // Only required
}
The redirect URI must match exactly with any of the registered redirect endpoints or the oauth flow will fail.
getAuthorizationURI
Get the Authorization URI for the app.
getToken (code, saveTokenFunction)
Exchange the Authorization Code for Access Token.
api (url, method, data, access_token, callback)
Executes an API call. This method differs from the request helper in requiring the accessToken and refreshToken to be manually provided. Visit the complete API reference
License
Playlyfe NodeJS SDK v0.0.1
https://dev.playlyfe.com/
Copyright(c) 2013-2014, Playlyfe Technologies, developers@playlyfe.com
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.