- Home /
Sharing session between app and browser ?
Hello,
How would you go about sharing session/cookie between app and browser ?
I am looking for general practice on this matter, which I can't find after an extensive lookup on google.
My specific requirements are an android app ; from this app I POST some data to a server (basically replicating the requests that happen when I click on some button on the webpage) ; and then I need to open a webpage in the default browser that will show the data I have posted. Think of it as adding items to a cart in the app and clicking on Checkout button to be redirected to the Cart/Checkout page on the website.
So far I have tried this :
1) Ping the server and get a cookie/session, either with a UnityWebRequest or with Application.OpenURL . I thought OpenURL would init a session on the actual browser and would be better than a communication strictly between server and app (where session id is contained in the app sandbox with no way to be shared with the browser when we open it for Checkout). But I don't know how to get cookie string from OpenURL... With a UnityWebRequest I obtain the cookie.
2) I add items with a POST request, passing the cookie as parameter
3) I now need to display the Cart webpage in the browser. I try to add the cookie as parameter in the url, but the page that opens has its own browser session, because it will not display the items added through the app, but it will show any items that was previously added via the website.
Sorry for the long specifics. I assumed these steps should do it but I don't know if I am on the right track at all.
Your answer
Follow this Question
Related Questions
What do I pass into Application.OpenURL to open up the Android market from an app? 2 Answers
go back to the app after leaving it to the Android main screen 1 Answer
Application.OpenURL on Unity 2017.2 and Android 7 not working 1 Answer
[Android] How to check if device can send SMS? 0 Answers
OpenURL not working on Android 3 Answers