Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/passport-instagram/strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Module dependencies.
*/
var util = require('util')
, crypto = require('crypto')
, OAuth2Strategy = require('passport-oauth').OAuth2Strategy
, InternalOAuthError = require('passport-oauth').InternalOAuthError;

Expand Down Expand Up @@ -76,7 +77,8 @@ Strategy.prototype.userProfile = function(accessToken, done) {
// the internal node-oauth module will have to be modified to support
// exposing this information.

this._oauth2.get('https://api.instagram.com/v1/users/self', accessToken, function (err, body, res) {
var sig = crypto.createHmac('sha256', this._oauth2._clientSecret).update('/users/self|access_token=' + accessToken).digest('hex');
this._oauth2.get('https://api.instagram.com/v1/users/self?sig=' + sig, accessToken, function (err, body, res) {
if (err) { return done(new InternalOAuthError('failed to fetch user profile', err)); }

try {
Expand Down