4 <div id="brapi_auth_home_div">
9 <input name="brapi_auth_login_username" id="brapi_auth_login_username" class="form-control" type="text" placeholder="Your Username" />
10 <input name="brapi_auth_login_password" id="brapi_auth_login_password" class="form-control" type="password" placeholder="Password" />
11 <button class="btn btn-primary" name="brapi_auth_login_submit" id="brapi_auth_login_submit">Login</button>
13 <div class="col-sm-6">
15 <button class="btn btn-danger" name="brapi_auth_logout_submit" id="brapi_auth_logout_submit">Logout</button>
23 jQuery(document).ready(function() {
24 jQuery("#brapi_auth_login_submit").click(function() {
26 'url': jQuery('#brapi_home_url_select').val()+'/brapi/v1/token',
29 'grant_type' : 'password',
30 'username' : jQuery("#brapi_auth_login_username").val(),
31 'password' : jQuery("#brapi_auth_login_password").val()
33 'success': function(response) {
34 console.log(response);
35 //jQuery("#brapi_auth_home_div").empty().html("Successfully logged in!"+response);
36 alert('Successfully logged in!'+response.userDisplayName + response.expires_in);
39 error: function(response) {
40 alert('An error occurred');
45 jQuery("#brapi_auth_logout_submit").click(function() {
47 'url': jQuery('#brapi_home_url_select').val()+'/brapi/v1/token',
49 'success': function(response) {
50 console.log(response);
51 alert('Successfully logged out!');
54 error: function(response) {
55 alert('An error occurred');