Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const kinveyUsername = "guest";
- const kinveyPasssword = "guest";
- const appKey = "kid_Syz-eCp-H";
- const appSecret = "853929bb0bfd44768b2972fcc9c74253"
- const baseUrl = 'https://baas.kinvey.com/appdata/kid_Syz-eCp-H/books';
- function login() {
- let url = 'https://baas.kinvey.com/user/kid_Syz-eCp-H/login'
- let userData = {
- username: "guest",
- password: "guest"
- }
- let headers = {
- method: "POST",
- mode: "no-cors",
- credentials: "include",
- body: JSON.stringify(userData),
- headers: {
- 'Content-Type': 'application/json',
- //Same as "Authorization": "Basic " + btoa(appKey + ':' + appSecret);
- "Authorization": "Basic a2lkX1N5ei1lQ3AtSDo4NTM5MjliYjBiZmQ0NDc2OGIyOTcyZmNjOWM3NDI1Mw=="
- }
- }
- fetch(url, headers)
- .then(res => res.json())
- .then(data => console.log(data))
- .catch(error => console.error(error));
- }
- login();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement