You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
installationId is not set in _Session object when using 3rd party auth and signUp #1097
I'm not sure if this causes any problem but I happened to notice that installationId seems to be missing in Session class when user logs in via Twitter (and possibly other oAuth methods)
@tanmays that would be related to the SDK not sending the X-Parse-Installation-Id header when logging in with twitter. Can you start your server with VERBOSE=1 and get me the logs that are printed when doing a twitter login? I'd be able to see if the headers are properly set, and in that case, tweak the implementation to properly set the installation ID. If the headers is not correctly set, that would be an error in the SDK you're using.
@flovilmart thanks! I'm not actually using any SDK for mobile apps but have all custom cloud code methods. I'll try passing installation token and get back. Thanks!
This returns a proper user object and everything works fine except the installationId field is still empty in Session class. I'm not sure how I'd pass an installationId in header before login, I guess that id is generated by parse-server.
@flovilmart I run the twitter login method directly via a rest api call made from iPhone and doing this results in installationId being empty.
I run the Parse.User.logIn method via Cloud Code. I do not pass any installation id in header while doing this and still it populates the installationId field on login via password. So I'm not sure how the installationId is generated in this case.
I just realised the installationId generated when logging in using a cloud code function is same even if actual devices making the cloud code request are different.
I think I need to be able to pass in an installationId to the Parse.User.logIn method. Any tips on how to pass in a device UUID to this method when using cloud code?
As for the Twitter login REST request, I passed in valid UUID in the header token and it still failed to add it to the installationId in Session class.
That seems to be a bug, as the installationId is expected in the data you pass instead of the request.info.
I don't think that causes any error for now, but I'll mark it as a bug
changed the title [-]InstallationId is empty in Session class for Twitter login[/-][+]installationId is not set in _Session object when using 3rd party auth[/+]on Mar 19, 2016
Yes but will that UUID be correctly added to the Session class? As I understand parse-server expects the installationId to be in a X-Parse-Installation-Id header. I'm not sure how to set headers when calling Parse.User.logIn from cloud code.
Right now Parse.User.logIn requires you to pass in username and password. It doesn't support email in place of username or say phoneNo in place of username. Cloud code allows me to first fetch a username in case its an email/phoneNo and then log user in. This way is much cleaner than making multiple calls client side and then logging in with username.
I need full pointer objects on login. Right now any pointers will not be returned in full. Using cloud code I can get all related pointer data in 1 request and client doesn't have to make additional unnecessary requests.
@flovilmart I was trying out the same with signUp and looks like its exhibiting the same behaviour with Session class as 3rd party auth.
The installationId fails to get set in signUp method as well, probably because the /users/ endpoint is same for both regular register and 3rd party register so they seem to be related.
Also the createdWith field is incorrectly populated as {"action":"login","authProvider":"password"} instead of {"action":"signup","authProvider":"password"}
changed the title [-]installationId is not set in _Session object when using 3rd party auth[/-][+]installationId is not set in _Session object when using 3rd party auth and signUp[/+]on Mar 20, 2016
Activity
flovilmart commentedon Mar 19, 2016
@tanmays that would be related to the SDK not sending the X-Parse-Installation-Id header when logging in with twitter. Can you start your server with VERBOSE=1 and get me the logs that are printed when doing a twitter login? I'd be able to see if the headers are properly set, and in that case, tweak the implementation to properly set the installation ID. If the headers is not correctly set, that would be an error in the SDK you're using.
tanmays commentedon Mar 19, 2016
@flovilmart thanks! I'm not actually using any SDK for mobile apps but have all custom cloud code methods. I'll try passing installation token and get back. Thanks!
tanmays commentedon Mar 19, 2016
@flovilmart just checked and I'm using the REST api to login via Twitter. Here's the request:
This returns a proper user object and everything works fine except the
installationIdfield is still empty inSessionclass. I'm not sure how I'd pass an installationId in header before login, I guess that id is generated by parse-server.flovilmart commentedon Mar 19, 2016
the installation-id is indeed generated by the client. you should be able to get it from PFInstallation.currentInstallation and add it to your headers
tanmays commentedon Mar 19, 2016
@flovilmart I run the twitter login method directly via a rest api call made from iPhone and doing this results in
installationIdbeing empty.I run the Parse.User.logIn method via Cloud Code. I do not pass any installation id in header while doing this and still it populates the
installationIdfield on login via password. So I'm not sure how the installationId is generated in this case.tanmays commentedon Mar 19, 2016
I just realised the
installationIdgenerated when logging in using a cloud code function is same even if actual devices making the cloud code request are different.I think I need to be able to pass in an installationId to the
Parse.User.logInmethod. Any tips on how to pass in a device UUID to this method when using cloud code?As for the Twitter login REST request, I passed in valid UUID in the header token and it still failed to add it to the
installationIdin Session class.Here's the request:
flovilmart commentedon Mar 19, 2016
That seems to be a bug, as the installationId is expected in the data you pass instead of the request.info.
I don't think that causes any error for now, but I'll mark it as a bug
[-]InstallationId is empty in Session class for Twitter login[/-][+]installationId is not set in _Session object when using 3rd party auth[/+]tanmays commentedon Mar 19, 2016
@flovilmart Thanks! As for my earlier question is there any way I can manually pass a device UUID to a
Parse.User.logInmethod in cloud code?flovilmart commentedon Mar 19, 2016
you can pass any parameters when you call you cloud function from Parse.Cloud.run see: https://parse.com/docs/cloudcode/guide#cloud-code-cloud-functions
tanmays commentedon Mar 19, 2016
Yes but will that UUID be correctly added to the Session class? As I understand parse-server expects the installationId to be in a
X-Parse-Installation-Idheader. I'm not sure how to set headers when callingParse.User.logInfrom cloud code.flovilmart commentedon Mar 19, 2016
I'm not sure about that either. why would you want to perform logins in cloud code as it's precisely meant to be done on a client?
tanmays commentedon Mar 19, 2016
Two reasons I'm doing it in cloud code.
Parse.User.logInrequires you to pass inusernameandpassword. It doesn't supportemailin place of username or sayphoneNoin place of username. Cloud code allows me to first fetch a username in case its an email/phoneNo and then log user in. This way is much cleaner than making multiple calls client side and then logging in with username.flovilmart commentedon Mar 19, 2016
So for that question, I recommend you ask around in Stackoverflow as this is not related to parse-server but with a specific point of implementation
tanmays commentedon Mar 20, 2016
I figured it out.
An update to the js sdk added ability to pass installationId.
Here's a short guide if anyone else wants to do this:
If you are using
parse-server-exampleopenpackage.jsonand edit value to"parse": "~1.8.1"installationIdto your cloud code'suser.signUpandParse.User.loginmethods.Sample cloud code function:
tanmays commentedon Mar 20, 2016
@flovilmart I was trying out the same with signUp and looks like its exhibiting the same behaviour with Session class as 3rd party auth.
The
installationIdfails to get set insignUpmethod as well, probably because the /users/ endpoint is same for both regular register and 3rd party register so they seem to be related.Also the
createdWithfield is incorrectly populated as{"action":"login","authProvider":"password"}instead of{"action":"signup","authProvider":"password"}Here's a request just in case:
[-]installationId is not set in _Session object when using 3rd party auth[/-][+]installationId is not set in _Session object when using 3rd party auth and signUp[/+]