Some Kinvey MIC allow for custom login pages. These will pop up for providers such as the Custom ALC, AD DLC, FlexAuth ALC.

This custom login page can be any webpage hosted by you, as long as it includes a <form> to submit to a Kinvey endpoint for user login.


Here’s the relevant <form> code you need to put in that page:

        <!-- LOGIN FORM   (please change auth.kinvey.com to your dedicated instance url if you are an Enterprise customer) -->

        <form action="https://auth.kinvey.com/oauth/login/" method="post">  

            <div class="form-group">

                <label>Username</label>

                <input type="text" class="form-control" id="username" name="username">

            </div>

            <div class="form-group">

                <label>Password</label>

                <input type="password" class="form-control" name="password">

            </div>

            <input type="hidden" id="client_id" name="client_id" />

            <input type="hidden" name="response_type" value="code" />

            <input type="hidden" id="redirect_uri" name="redirect_uri" />

            <button type="submit" class="btn btn-warning btn-lg">Login</button>

        </form>


You can hardcode the client_id (which is the Kinvey “kid”) and redirect_uri into the form, or you can keep it as a dynamically generated attributed since Kinvey actually passes this info as parameters to your custom form, so you can pick them up with this javascript code:


      <script type="text/javascript">

        function getvar(name){

           if(name=(new RegExp('[?&]'+encodeURIComponent(name)+'=([^&]*)')).exec(window.location.search))

           return decodeURIComponent(name[1]);

        }

        document.getElementById('client_id').value=getvar('client_id');

        document.getElementById('redirect_uri').value=getvar('redirect_uri');

     </script>