Android devices, ionic app and $cookies

I’m trying to create a little mobile app with ionic and a wordpress (and JSON API) for backend.

I choose cookie auth for log people. This méthode work perfectly in my web browser thanks but when I use “phonegap serve” or apk directly on my phone nothing happen.

Read More

According to following lines $cookies.put(…) seems not working on my Android device.

console.log("Cookie: ");
$cookies.put(data['cookie_name'],data['cookie']);
console.log($cookies.getAll());

Have you some idea to resolve my problem ?

Thank you

Related posts

1 comment

  1. You can’t use cookies, you should use localStorage.

    To set the localstorage:

    window.localStorage.setItem("key", "value");
    

    To retrieve localstorage:

    var value = window.localStorage.getItem("key");
    

    To remove particular localstorage:

    window.localStorage.removeItem("key");
    

    To clear all localstorage:

    window.localStorage.clear();
    

    For your reference, you can use this link.

    I am sure, this will help you.

Comments are closed.