Comments (7)
I found the issue. In oauth.js I added the following debug code:
// Obtain token
Wreck.post(settings.provider.token, requestOptions, function (err, res, payload) {
console.log("ERR: ", err);
console.log("payload: ", payload);
console.log("res: ", res);
This give me a more in-deep analysis about my misconfiguration. Specifically, I found that the app was configured as a Desktop one. Changing the settings from Facebook developers app, Advanced Settings, solved the issue.
I also reverted the server configuration as follow:
server.register(Bell, function (err) {
server.auth.strategy('facebook', 'bell', {
provider: 'facebook',
password: 'password',
isSecure: false,
// Make sure to set a "Callback URL" and
// check the "Allow this application to be used to Sign in with Twitter"
// on the "Settings" tab in your Twitter application
clientId: '832516966762800', // Set client id
clientSecret: '4256a8f3a381735507d0a2eb67770577' // Set client secret
});
server.route({
method: '*',
path: '/bell/facebook',
config: {
auth: 'facebook',
handler: function (request, reply) {
reply('<pre>' + JSON.stringify(request.auth.credentials, null, 4) + '</pre>');
}
}
});
});
now, It works like a charm.
from bell.
@valvoline glad it all worked out. Are you interested in adding a Facebook example to the /examples folder?
from bell.
Sure,
I have also just completed a provider for linkedin and it works like a charm. Are you interested?
regards,
—
c.
On 15 Dec 2014, at 18:32, Wyatt Preul [email protected] wrote:
@valvoline https://github.com/valvoline glad it all worked out. Are you interested in adding a Facebook example to the /examples folder?
—
Reply to this email directly or view it on GitHub #46 (comment).
from bell.
@valvoline absolutely interested, thanks!
from bell.
@valvoline can u provide the linkedin config?
thanks a ton!
from bell.
Absolutely yes!
I have no time at the moment to fork a branch, so I attach here our working config.
on your server.js (or whatever you maintain your route / auth strategy) add the following:
server.auth.strategy('linkedin', 'bell', {
provider : 'linkedin',
password : 'password',
isSecure : false,
clientId : '#yourClientID#',
clientSecret : '#yourClientSecret#'
});
server.route({
method: '*',
path: '/bell/linkedin',
config: {
auth: 'linkedin',
handler: function (request, reply) {
console.log('credentials: ' + request.auth.credentials);
}
}
});
Also, under bell/providers folder, create a linkedin.js file with the following content:
//
// linkedin plugin bell/hapijs
//
// Created by valvoline on 15/12/14.
// Copyright (c) 2014 Costantino Pistagna. All rights reserved.
//
// Load modules
var Crypto = require('crypto');
// Declare internals
var internals = {};
exports = module.exports = function (options) {
return {
protocol: 'oauth2',
auth: 'https://www.linkedin.com/uas/oauth2/authorization',
token: 'https://www.linkedin.com/uas/oauth2/accessToken',
scope: ['r_fullprofile', 'r_emailaddress', 'r_network', 'r_contactinfo', 'rw_groups'],
scopeSeparator: ',',
profile: function (credentials, params, get, callback) {
var query = {
format: 'json',
appsecret_proof: Crypto.createHmac('sha256', this.clientSecret).update(credentials.token).digest('hex')
};
get('https://api.linkedin.com/v1/people/~:(id,first-name,last-name,industry,associations,interests,publications,patents,languages,skills,educations,three-current-positions,num-recommenders,following,suggestions)', query, function (profile) {
credentials.profile = profile;
return callback();
});
}
};
};
Also, be sure to modify your bell/lib/providers/index.js file accordingly:
exports = module.exports = {
linkedin: require('./linkedin'),
...
That's all! Happy OAuth2
from bell.
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
from bell.
Related Issues (20)
- Support for idp with self signed certificates HOT 3
- Only node 12
- Require hapi 19
- Change plugin name to @hapi/bell
- Expose public API to refresh tokens HOT 2
- Replace Yahoo Social Directory Web Service HOT 2
- Issue with the meetup provider HOT 1
- "Failed obtaining twitch user profile" when using Twitch provider HOT 4
- Support functions for `provider.auth` and `provider.token` HOT 2
- Sign in with apple HOT 5
- Using for 3rd party tenants HOT 3
- docs: api page tutorial links to dead page HOT 1
- Improve the debugging experience when a payload is involved HOT 1
- Please document usage of local strategy
- Support client credentials as functions HOT 3
- Improve handling of rate limiting by Okta provider
- Add timeout configuration for requests
- Change callback path HOT 4
- Big cookie size
- Twitter auth no longer working HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bell.