Skip to content

Commit

Permalink
start readme
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewglover committed Sep 8, 2016
1 parent 5d136d7 commit 23c17b6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
11 changes: 6 additions & 5 deletions integration/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ const configs = [
provider: 'facebook',
loginPath: '/fb-login',
authPath: '/fb-auth',
redirectPath: '/process-jwt',
redirectPath: '/process-login',
baseUrl: process.env.BASE_URL,
clientId: process.env.FB_CLIENT_ID,
clientSecret: process.env.FB_CLIENT_SECRET,
options: {
scope: 'user_likes',
},
},
];

Expand All @@ -22,10 +25,8 @@ const plugin = {

const processJwtRoute = {
method: 'GET',
path: '/process-jwt',
handler: (req, reply) => {
reply(req.query.jwt);
},
path: '/process-login',
handler: (req, reply) => reply(req.query),
};

const server =
Expand Down
6 changes: 3 additions & 3 deletions lib/fb_login/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ const FACEBOOK_PATH = '/dialog/oauth';


// authQuery :: AuthConfig -> String
const authQuery = ({ clientId, baseUrl, authPath }) =>
`?${querystring.stringify({
const authQuery = ({ clientId, baseUrl, authPath, options }) =>
`?${querystring.stringify(Object.assign({
client_id: clientId,
redirect_uri: baseUrl + authPath,
})}`;
}, options || {}))}`;

// createUri :: String -> String -> String -> String
const createUri = curry((url, path, query) =>
Expand Down
4 changes: 2 additions & 2 deletions lib/fb_login/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const { createRedirectUri } = require('./helpers');
// }

// fbLogin :: LoginConfig -> Hapi.Route
const fbLogin = ({ loginPath, clientId, baseUrl, authPath }) => {
const redirectUri = createRedirectUri({ clientId, baseUrl, authPath });
const fbLogin = ({ loginPath, clientId, baseUrl, authPath, options }) => {
const redirectUri = createRedirectUri({ clientId, baseUrl, authPath, options });

return {
method: 'GET',
Expand Down

0 comments on commit 23c17b6

Please sign in to comment.