Jump to content

JoellaLoge

Members
  • Posts

    1
  • Joined

  • Last visited

JoellaLoge's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Developing an application that uses the Caspio API and facing weird issues with caspio api.For 3 days, I'm not able to understand the issue. I have posted many articles on different forums, but no good answers. Right now, I am getting 400 Status code message on implementing the solution. What is going wrong in the solution? I am doing authentication using CASPIO below: As an alternative to including credentials in the request body. I am including credentials in the body. Right now, a client can easily use HTTP basic authentication. In my method, I am following the following way of authenticating: Method in PHP: Post URL I am trying to use: Endpoint Body of the code: access_type = login and password of client Codes: Javascript var Currentfuncuser = "clientID"; var funcuserPass = "secretKey"; function authenticatetheUser(funcuser, funcuserPass) { var authtok = funcuser + ":" + funcuserPass; // Should i be encoding this value????? does it matter??? // Base64 Encoding -> btoa var currentH = btoa(authtok); return "Simple" + currentH; } function CallingtheAPI() { // New XMLHTTPRequest var newXMLRequest = new XMLHttpRequest(); newXMLRequest.open("POST", "https://xxx123.caspio.com/oauth/token", false); newXMLRequest.setRequestHeader("Authorization", authenticatefuncuser(Currentfuncuser, funcuserPass)); newXMLRequest.send(); // view request status alert(newXMLRequest.status); response.innerHTML = newXMLRequest.responseText; } HTML <div> <div id="response"> </div> <input type="button" class="primary" value="Simple API Call" onclick="javascript:CallingtheAPI;" /> Solutions tried: Someone told that you need oAuth authentication protocol rather than simple authentication. After that have to set 'setHeaderRequest', with changes. Another Issue: I am handling some clients websites. And when, I tried to work with maps API, which are currently telling the locations of the bases. And also, multiple zoom-in maps on the directory pages, but the pages are loading slowly. Example, militarybases.....navy-base-kitsap-navy-base-in-silverdale-wa/ contain only 1 map. And I want to host multiple maps(which is necessary in order to show the clearly zoomed-in location). It is the test phase, if successful. I have to integrate the full site.
×
×
  • Create New...