Backendless Support
 
In Progress

Server Code - beforeSocialLogin method never called

Hello,

I use REST API and am firing https://api.backendless.com/v1/users/social/facebook/sdk/login POST request to register and login users. I've created beforeSocialLogin and afterSocialLogin handlers however they are never called. To check if debugger is set up correctly I've also created beforeSocialRegister handler and it looks ok - it is called when the user is created in a database.

What I'm trying to do is to:

1. Register or login user with provided Facebook access token.

2. Create a business logic event handler which will make a call to Facebook Graph API and update created user with more data.

So my questions:

1. Why the SocialLogin handlers are not called?

2. Let's assume the handlers work as expected. Is the Facebook access token passed into them so I can make a call to Graph API?

3. Is it OK, from a security perspective, to store the access token in the Users table for each user?

4. Is there any other way to achieve this?

My app id is CCD7530E-CD7B-3B6E-FF2E-B153FE232B00

Thank you in advance for your response.

Best,

Matt

Leave a Comment

Comments (9)

photo
1

Hi, Matt.

Firstly i want to ask you to try create simple before and after SocialLogin handlers with System.out.println or Backendless.log for example. Then try this code in debug mode CodeRunner and in production when you will make social login. Please, use the latest version of CodeRunner. If you will have an error, please post it here.

Concerning access token: what token do you want to store ? Facebook ?

Whatever it was, you can save this data in any table and only user and role permissions would control access restrictions for it.

photo
1

Hi Oleg thanks for response and sorry for late reply.

I tested with handlers

  1. @Override

    public void beforeSocialLogin( RunnerContext context, Map<String, String> userProperties, SocialType socialType ) throws Exception

    {

    Logger logger = Backendless.Logging.getLogger( "com.logger" );

    logger.info("before login");

    }

    @Override

    public void afterSocialLogin(RunnerContext context, Map<String, String> userValues, SocialType socialType, ExecutionResult<HashMap> result) throws Exception {

    Logger logger = Backendless.Logging.getLogger( "com.logger" );

    logger.info("after login");

    }

    @Override

    public void beforeSocialRegister(RunnerContext context, Map<String, String> userValues, SocialType socialType) throws Exception {

    Logger logger = Backendless.Logging.getLogger( "com.logger" );

    logger.info("before register");

    }

in debug and production.

Log is produced only for before register handler. Before and after social login are never called. I'm using latest CodeRunner version.

Best,

Matt

photo
1

Hey, any updates on this issue?

photo
1

Hi Matt,

Thanks for reporting, we're now aware of this issue and will fix it in one of the following releases. We shall notify you as soon as it's stable.

photo
1

Thanks.

photo
1

Hello,

have the same issue with the social event handlers. beforeLogin / beforeRegister works fine, but socialBeforeLogin / socialBeforeRegister are never called. Is the solution for this problem is still in progress?

Thank you!,

Alex

photo
1

Alex,

is this with the 4.0 or the 3.x backend?

Mark

photo
1

Hello Mark,

with 4.0 backend.

photo
1

Thanks, Alex. We will look into it and report back.

photo