@@ -229,6 +229,7 @@ RestWrite.prototype.handleFacebookAuthData = function() {
229
229
this . className ,
230
230
{ 'authData.facebook.id' : facebookData . id } , { } ) ;
231
231
} ) . then ( ( results ) => {
232
+ this . storage [ 'authProvider' ] = "facebook" ;
232
233
if ( results . length > 0 ) {
233
234
if ( ! this . query ) {
234
235
// We're signing up, but this user already exists. Short-circuit
@@ -238,7 +239,6 @@ RestWrite.prototype.handleFacebookAuthData = function() {
238
239
location : this . location ( )
239
240
} ;
240
241
this . data . objectId = results [ 0 ] . objectId ;
241
- this . data . createdWith = "facebook" ;
242
242
return ;
243
243
}
244
244
@@ -251,6 +251,8 @@ RestWrite.prototype.handleFacebookAuthData = function() {
251
251
// We're trying to create a duplicate FB auth. Forbid it
252
252
throw new Parse . Error ( Parse . Error . ACCOUNT_ALREADY_LINKED ,
253
253
'this auth is already used' ) ;
254
+ } else {
255
+ this . data . username = rack ( ) ;
254
256
}
255
257
256
258
// This FB auth does not already exist, so transform it to a
@@ -274,7 +276,6 @@ RestWrite.prototype.transformUser = function() {
274
276
var token = 'r:' + rack ( ) ;
275
277
this . storage [ 'token' ] = token ;
276
278
promise = promise . then ( ( ) => {
277
- // TODO: Proper createdWith options, pass installationId
278
279
var expiresAt = new Date ( ) ;
279
280
expiresAt . setFullYear ( expiresAt . getFullYear ( ) + 1 ) ;
280
281
var sessionData = {
@@ -286,7 +287,7 @@ RestWrite.prototype.transformUser = function() {
286
287
} ,
287
288
createdWith : {
288
289
'action' : 'login' ,
289
- 'authProvider' : this . data . createdWith || 'password'
290
+ 'authProvider' : this . storage [ 'authProvider' ] || 'password'
290
291
} ,
291
292
restricted : false ,
292
293
installationId : this . data . installationId ,
@@ -413,6 +414,8 @@ RestWrite.prototype.handleSession = function() {
413
414
414
415
if ( ! this . query && ! this . auth . isMaster ) {
415
416
var token = 'r:' + rack ( ) ;
417
+ var expiresAt = new Date ( ) ;
418
+ expiresAt . setFullYear ( expiresAt . getFullYear ( ) + 1 ) ;
416
419
var sessionData = {
417
420
sessionToken : token ,
418
421
user : {
@@ -424,7 +427,7 @@ RestWrite.prototype.handleSession = function() {
424
427
'action' : 'create'
425
428
} ,
426
429
restricted : true ,
427
- expiresAt : 0
430
+ expiresAt : Parse . _encode ( expiresAt )
428
431
} ;
429
432
for ( var key in this . data ) {
430
433
if ( key == 'objectId' ) {
0 commit comments