Understanding User Login API Specifications for Monaca Backend

Asked 4 months ago, Updated 4 months ago, 8 views

Using OnsenUI, Monaca backend API, you create an app that adds items to the backend collection when you press the button after logging in.

After logging in, I tried to get the OID of the user using monaca.cloud.User._oid, but it contains NULL.Will the login state not be maintained in the app after logging in?


2022-09-30 13:48

1 Answers

The login process is asynchronous, so if you try to retrieve it below .then(), you should be able to retrieve it.Present your own sample code.If you don't mind, please move it.It was created by editing a minimum template.

    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scale=no">
    <script src="components/loader.js"></script>
    <link rel="stylesheet" href="components/loader.css">
    <link rel="stylesheet" href="css/style.css">

        document.addEventListener('device ready', onDR, false);

        function onDR(){
            alert('device ready come!');
            monaca.cloud.User.login("hoge", "hogehoge")

2022-09-30 13:48

If you have any answers or tips

© 2023 OneMinuteCode. All rights reserved.