Giter Site home page Giter Site logo

parse-facebook-user-session's People

Contributors

bklimt avatar daviddoran avatar gfosco avatar hramos avatar jamesgpearce avatar lacker avatar leebyron avatar ssk7833 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

parse-facebook-user-session's Issues

Javascript SDK not detecting user logged in using parseFacebookUserSession

The following code

Parse.initialize("key...","key...");
var currentUser = Parse.User.current();

When run after logging in a user using "parse-facebook-user-session.js", sets the currentUser as "null"

Is there a way for the cloud code to communicate the current facebook user session to the javascript SDK?

Getting "101 - invalid session"

I'm trying out this middleware but I'm always getting error code 101 - invalid session originating from line: https://github.com/ParsePlatform/parse-facebook-user-session/blob/master/parse-facebook-user-session.js#L136

The rest of the verbose output looks fine

I2015-06-07T21:23:34.402Z]Redirecting for Facebook OAuth.
I2015-06-07T21:23:35.106Z]Handling request callback for Facebook login...
I2015-06-07T21:23:35.310Z]Fetching user data from Facebook...
I2015-06-07T21:23:35.462Z]Logging into Parse with Facebook token...
I2015-06-07T21:23:36.024Z]Failed! {"code":101,"message":"invalid session"}

I'm using the "new" revocable sessions and am considering if this could be related?

Result: TypeError: Cannot call method 'restoreAuthentication' of undefined

Here's my app.js:
---------------------------| app.js |------------------------------------------

// These two lines are required to initialize Express in Cloud Code.
express = require('express');
app = express();

var parseExpressHttpsRedirect = require('parse-express-https-redirect');
var parseExpressCookieSession = require('parse-express-cookie-session');
var parseFacebookUserSession = require('cloud/parse-facebook-user-session');

// Global app configuration section
app.set('views', 'cloud/views'); // Specify the folder to find templates
app.set('view engine', 'ejs'); // Set the template engine
app.use(express.bodyParser()); // Middleware for reading request body

// FB stuff
app.use(parseExpressHttpsRedirect()); // Require user to be on HTTPS.
app.use(express.bodyParser());
app.use(express.cookieParser('fdft453242f'));
app.use(parseExpressCookieSession({ cookie: { maxAge: 3600000 } }));
// /FB stuff

var fbLogin = parseFacebookUserSession({
clientId: 'my client id',
appSecret: 'MY_APP_SECRET',
redirectUri: '/secret',
scope: 'user_friends',
});

// This is an example of hooking up a request handler with a specific request
// path and HTTP verb using the Express routing API.
app.get('/', function(req, res) {
res.render('main', { message: 'Congrats, you just set up your app!' });
});

// To handle the login redirect.
app.get('/login', fbLogin, function(req, res) {});

app.get('/secret', fbLogin, function(req, res) {
// This page requires Facebook login.
res.render('secret', { message: 'Congrats, you are logged in!!' });
});

// Attach the Express app to Cloud Code.
app.listen();
---------------------------| /app.js |------------------------------------------

When going to /secret, i get forwarded to facebook login page, if I login, I get diverted back to /secret with ?code=XXXXXXX at the end of address but error in log:

E2015-09-16T09:03:10.606Z]v14 Ran custom endpoint with:
Input: {"method":"GET","url":"/secret?code=XXXXXXXXX","headers":{"accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image
/webp,/;q=0.8","accept-encoding":"gzip, deflate, sdch","accept-language":"en-US,en;q=0.8,et;q=0.6","cache-control":"
ma... (truncated)
Result: TypeError: Cannot call method 'restoreAuthentication' of undefined
at t.s.value (Parse.js:13:14231)
at t.s.value (Parse.js:13:14403)
at Object.T.setCurrentUser (Parse.js:13:18637)
at e. (Parse.js:13:21603)
at e.s (Parse.js:12:26759)
at e.n.value (Parse.js:12:26178)
at e. (Parse.js:12:26831)
at e.s (Parse.js:12:26759)
at Parse.js:12:27145
at i (Parse.js:12:27100)

Am i doing something wrong?

user.get('name') returns undefined

When using the following code sample:
app.get('/', function(req, res) {
var user = Parse.User.current();

res.render('hello', {
message: 'Congrats, you are logged in, ' + user.get('name') + '!'
});
});

The user.get('name') function returns "undefined"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.