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:
  3. Why the SocialLogin handlers are not called?
  4. 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?
  5. Is it OK, from a security perspective, to store the access token in the Users table for each user?
  6. 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

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.

Hi Oleg thanks for response and sorry for late reply.

I tested with handlers

@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

Hey, any updates on this issue?

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.

Thanks.

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

Alex,

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

Mark

Hello Mark,

with 4.0 backend.

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