• Welcome to KonaKart Community Forum. Please login or sign up.
 

Login integration.

Started by shaydes, August 15, 2007, 04:21:25 pm

Previous topic - Next topic

shaydes

Hi,

We have our own application which requires login. I am able to register the user to KK. I am entering KK application by adding an item to the cart from our application. How can I make sure that the user is automatically logged into the KK application and add items to the cart without having to go through your login screens.

john

Hi Shaydes,

If I understand you correctly you will need to use the login call of the KonaKart API.  This will return a sessionId that you can use for subsequent operations.   There are some examples of this in the API examples at http://www.konakart.com/apiexamplesfaq.php

For ease of reference, you probably need something like this:

        /*
         * Instantiate a KonaKart Engine instance
         */
        Class engineClass = Class.forName("com.konakart.app.KKEng");
        eng = (KKEngIf) engineClass.newInstance();

        /*
         * Login with credentials
         */
        sessionId = eng.login(USERNAME, PASSWORD);

Regards,
John

shaydes

Hi,

When we login to our application, we login to KK using exactly the method you showed below. Following that a user decides to buy an item. At present we are using .../AddToCartFromProdId.do?prodId=xxx. The control is trasnferred to the correct page but KK login is no longer valid. We have modified the default application's tiles to suit our need. We have added all the items so that when we come in through default application it works properly.

paolo

Hi,

The Struts actions use the client engine so you must first login using the same code as you can find in LoginSubmitAction.java. Once you've done that, AddToCartFromProdId should work properly because the client engine stores the session id and automatically passes it to the server engine which actually performs the "addToCart".

-Paolo

shaydes


BruceLee

We have same requirement:  we want our application's user to auto login to KonaKart and checkout.
I use WebWork2 as our web framework. Since you mention that only calling kkEng.login() is not enough, Struts action LoginSumitAction type of thing is needed.
Is it a way to do that with WebWork2 ( or any other Web framework)?
Basically we want get the session id, and let KonaKart client engine also keeps this id.
Question is, how does client engine decide that this request has same session id as previous page from our WebWork JSP?

Correct me if I looks stupid. Maybe I'm:)
Thanks!
-Bruce

Quote from: paolo on August 16, 2007, 12:47:29 pm
Hi,

The Struts actions use the client engine so you must first login using the same code as you can find in LoginSubmitAction.java. Once you've done that, AddToCartFromProdId should work properly because the client engine stores the session id and automatically passes it to the server engine which actually performs the "addToCart".

-Paolo

paolo

Hi Bruce,

I don't know the details of WebWork2 so I can only give you a general answer.

When you log in through the client engine (like LoginSubmitAction), the engine creates a KK session and stores it as a parameter of the servlet engine session. Therefore as long as the servlet engine session doesn't change you will remain logged in. Maybe you should just try it out with your framework and see what happens ?

-Paolo

BruceLee

Thank Paolo for reply. Still questions:
1) How does KK engine determine it's identical serverlet session? from the request source IP address and/or others?
2) How does other web components (like WebWork2 Action) call KK client API (which is Struts Action)?
KK website mentions the OpenLazb Flash application, do you open it's source code?
Or do you have sample using other web components to access KK client API, besides Struts?
3) Since WebWork2 and Struts are converging to Struts 2, does KonaKart plan to upgrade to it in near futher?

Thanks!
-Bruce

paolo

Thank Paolo for reply. Still questions:
1) How does KK engine determine it's identical serverlet session? from the request source IP address and/or others?

KK relies on the Servlet engine for this. The servlet engine may use cookies or even append a parameter to the URL if the client doesn't support cookies.

2) How does other web components (like WebWork2 Action) call KK client API (which is Struts Action)?

The KK client API is independent of Struts. It just so happens that most of the calls to this API are from Struts actions in our application. It works in a similar way to the server API. i.e.:

KKAppEng kkAppEng = new KKAppEng();
kkAppEng.setPageTitle("Hello World");


KK website mentions the OpenLazb Flash application, do you open it's source code?
Or do you have sample using other web components to access KK client API, besides Struts?

Yes, I think that we've now sent you the source of this.

3) Since WebWork2 and Struts are converging to Struts 2, does KonaKart plan to upgrade to it in near futher?

No immediate plans. Our eCommerce engines are independent of Struts although our example application uses Struts. We encourage anyone to take our application as an example (since we supply the source of the Struts actions and JSPs) and to develop something similar calling our APIs using whatever technology or framework they prefer.

Regards,

Paolo

BruceLee

Thank Paolo for helpful info. I already got the OpenLaszb source. -Bruce