Topic
9 replies Latest Post - ‏2012-08-21T08:44:43Z by IdanAdar
SystemAdmin
SystemAdmin
570 Posts
ACCEPTED ANSWER

Pinned topic Notification's problem with adapter based authenticator

‏2012-04-16T13:42:12Z |
Hi There

I'm running WL Studio 4.2.2 and WL server Build Version: 4.2.2

I want to use Authentication and push notification module for my app. I just can't combine adapter based Authentication and push notification module while combining form based Authentication and push notification module just works fine.

I add loginExtension into authenticationConfig.xml's realm tab, so when I login this realm, it suppose to register to C2DM server(ps. I run this app on Android devices). I monitored logcat and find out that it registers to C2DM server when I use form_based authenticator and it
does not
registers to C2DM server when I use adapter_based authenticator

I just copy the codes in auth.js from worklight's official demo and do a little change.

Did I do something wrong? Could anyone help me?

Thanks, Tim
  • IdanAdar
    IdanAdar
    288 Posts
    ACCEPTED ANSWER

    Re: Notification's problem with adapter based authenticator

    ‏2012-04-16T14:24:11Z  in response to SystemAdmin
    Hi Tim,
    It's not enough to know the version you're using (4.2.2), we also need the build number - 1283, 1294, 1299... You can see this in the CMD window when the server loads up or via Worklight Console >> About, or via Eclipse >> About.

    As for the authentication problem you're facing, please attach your project.
    We'll take a look.
  • SystemAdmin
    SystemAdmin
    570 Posts
    ACCEPTED ANSWER

    Re: Notification's problem with adapter based authenticator

    ‏2012-08-20T07:14:43Z  in response to SystemAdmin
    Hi,

    I got same problem, anybody find the cause?

    I can run example app too, fail to run adapter-based authenticator, from the logcat, I don't find any logs for registering google server.
    Daniel
  • IdanAdar
    IdanAdar
    288 Posts
    ACCEPTED ANSWER

    Re: Notification's problem with adapter based authenticator

    ‏2012-08-20T07:17:48Z  in response to SystemAdmin
    Daniel,
    Please be more elaborate...

    Are you using Worklight 4.2 or 5.0.x?
    Are you using Worklight 4.2 samples or Worklight 5.0.x samples?
    Are you trying to use C2DM? Google no longer supports new C2DM addresses, rather only already-existing (old) C2DM addresses.

    I cannot help you without more information.

    Idan Adar
    QA Engineer
    IBM Worklight Mobile Platform
    • SystemAdmin
      SystemAdmin
      570 Posts
      ACCEPTED ANSWER

      Re: Notification's problem with adapter based authenticator

      ‏2012-08-21T04:03:04Z  in response to IdanAdar
      Hi, Idan,

      My environment is:
      eclipse plugin: 4.2.1.1189.
      worklight server: 4.2.1.1183.

      I got sample package named "module_41_0_PushNotifications" from "Gordon Fung@WebSphere, Software Group, IBM China / Hong Kong Limited", but I found that some files are not for 4.2.1, i.e. <className>com.worklight.core.auth.ext.FormBasedAuthenticator</className>, on 4.2.1, it is com.worklight.auth.ext.FormBasedAuthenticator.

      So I find back 4.2.1 training and example package named "module_21_0_PushNotifications". this can work after I configured a Gmail account with C2DM enabled (Enable some indicators from Google API Console), in application-descriptor.xml, gmail account and password is given, I guess that 4.2.1 supports only old c2dm (new Google Cloud Messaging uses project id as api token but 4.2.1 gives gmail account and password). With the sample I can get 'Registering to c2dm' from logcat and device token updated to server from the logcat, I can submit a notification text with OK message returned.

      My Google Nexus S phone configured 3 gmail accounts, 1 of them C2DM Google API enabled and configured for Push Notification in application-descritor.xml.

      after sample app tested, I just copy settings and script to my app which uses adapter-based authenticator (i.e. create event data source, give onReadyToSubscribe callback). after login finished, i don't find 'Registering to c2dm' from logcat.

      I put an alert statement to WL.Client.Push.onReadyToSubscribe, I don't get the alert dialog after login finished.

      please find attached app. only biz related logo/data removed. all technical stuff kept.
  • IdanAdar
    IdanAdar
    288 Posts
    ACCEPTED ANSWER

    Re: Notification's problem with adapter based authenticator

    ‏2012-08-21T04:30:11Z  in response to SystemAdmin
    Google has switched to a new 'push notifications' technology called GCM.
    New C2DM email addresses are no longer accept by Google.

    To use GCM you will have to move forward to the next IBM Worklight release, coming in the near future.

    Idan Adar
    QA Engineer
    IBM Worklight Mobile Platform
    • SystemAdmin
      SystemAdmin
      570 Posts
      ACCEPTED ANSWER

      Re: Notification's problem with adapter based authenticator

      ‏2012-08-21T05:49:14Z  in response to IdanAdar
      Hi Idan,

      then IBM don't have any plans to give maintenance patches for 4.2.1? If so, then I'm required to study worklight 5.

      Google C2DM page says existing app still continue to work.

      == Google Says ===
      Important: C2DM has been officially deprecated as of June 26, 2012. This means that C2DM has stopped accepting new users and quota requests. No new features will be added to C2DM. However, apps using C2DM will continue to work. Existing C2DM developers are encouraged to migrate to the new version of C2DM, called Google Cloud Messaging for Android (GCM). See the C2DM-to-GCM Migration document for more information. Developers must use GCM for new development.
  • IdanAdar
    IdanAdar
    288 Posts
    ACCEPTED ANSWER

    Re: Notification's problem with adapter based authenticator

    ‏2012-08-21T06:12:45Z  in response to SystemAdmin
    At the moment there are no plans to bring GCM to Worklight 4.2; for this you will need to use Worklight 5.

    Idan Adar
    QA Engineer
    IBM Worklight Mobile Platform
    • SystemAdmin
      SystemAdmin
      570 Posts
      ACCEPTED ANSWER

      Re: Notification's problem with adapter based authenticator

      ‏2012-08-21T08:37:19Z  in response to IdanAdar
      Hi, Idan,

      I get same error when I run sample application on Worklight 5.0 developer edition. Have worklight 5 developer edition already migrated C2DM to GCM?

      I restart embedded server, and then login to worklight app from my phone, click 'Subscribe' button, and then call URL http://localhost:8080/dev/invoke?adapter=PushAdapter&procedure=submitNotification&parameters= %5B%22john%22%2C%22Hello%2C+John%22%5D from browser, i got log as attached below. the error is 'C2DM authentication token expired'.

      ==== this is my log =========
      Activating Worklight project: a...
      Activation done.
      2012-08-21 16:35:22 Detected more than one IP address. Using 192.168.11.16 as the public IP address of the Worklight Server. You can set a different IP address in worklight.properties.
      2012-08-21 16:35:25 >> deviceUnsubscribeFunc
      2012-08-21 16:35:29 >> deviceSubscribeFunc
      2012-08-21 16:35:33 submitNotification >> userId :: john, text :: Hello, John
      2012-08-21 16:36:37 C2DM authentication token expired
  • IdanAdar
    IdanAdar
    288 Posts
    ACCEPTED ANSWER

    Re: Notification's problem with adapter based authenticator

    ‏2012-08-21T08:44:43Z  in response to SystemAdmin
    As I wrote above, you will have to wait for the next IBM Worklight release in order to use GCM; this will come in the near future.

    Idan Adar
    QA Engineer
    IBM Worklight Mobile Platform