Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
New Contributor
Posts: 4
Registered: ‎12-25-2011
My Device: 9800 simulator
My Carrier: none

Trouble with cookies

Hey forum,

I'm trying to write a new program for BB using JRE 6.0 in which the user is able to sign in using Google openID.

At first I'm sending a request for my server to get the google url so it can keep the session then

I'm loading the url using BrowserField, let the user enter his details and in the end of the process I get the session ID.

the trouble occurs when another user trying to log in using the same app - the BrowserField/BB saving some cookies about the user and instead of his sign in screen, Google automaticly give me the previous user session.

 

// Getting Google URL
strData = new AccountServerDA().getOpenIDUrl(strProvider,strEmail);

// Trying to set a cookie
BrowserFieldCookieManager cookieMan = myBrowserField.getCookieManager();
Dialog.alert("Current Cookie: " + cookieMan.getCookie(strData));
cookieMan.setCookie(strData, "");
Dialog.alert("New Cookie: " + cookieMan.getCookie(strData));

myBrowserField.setFocus();
myBrowserField.requestContent(strData);

I tried doing .refresh(), setting a new cookie using CookieManager (as you can see in the example) and also asking for requestContent with Hashtable holding an empty cookie. none of those methods helped.

As anyone got an idea how can I delete/replace those cookies and let a new user use the openid screen?

 

Much obliged,

Yaniv

New Contributor
Posts: 4
Registered: ‎12-25-2011
My Device: 9800 simulator
My Carrier: none

Re: Trouble with cookies

Oh, and deleting the field and creating it again doesn't help as well.

Developer
Posts: 729
Registered: ‎05-04-2011
My Device: 9700

Re: Trouble with cookies

[ Edited ]

Hi Yaniv,

 

You can try and initiate the browserField before the second user request:

 

myBrowserField = new BrowserField();

 

Hope that helps,

 

E.

 

[EDIT]

 

Just saw your second post...

 

Have you tried to reset the CookieManager?

 

You can do it using the BrowserFieldConfig object.

 

E.

 

 

New Contributor
Posts: 4
Registered: ‎12-25-2011
My Device: 9800 simulator
My Carrier: none

Re: Trouble with cookies

Thanks maadani. Can you please elaborate on how to reset the CookieManager? I only successed in implmanting a new one but which can't handle cookies so google had to reject my request...

Highlighted
New Contributor
Posts: 6
Registered: ‎05-08-2012
My Device: BB 9800
My Carrier: At&t

Re: Trouble with cookies

Hi ,

 

I am stuck with the same issue.

 

i am unable to clear cookies in the browserfield's cookieManager.  Creating a new instance of BrowserField did not help, because if i do  newInstanceBF.getcookieManager() will still give me all the existing cookies.

 

How can i flush all the cookies ?  Please suggest 

 

Thanks.