javascript-sdk-and-javascript-signin

Home - javascript-sdk-and-javascript-signin

Abdul Muhit asked 7 months ago

Hello, I\’m javascript develeper (newbie), i want to ask two qustions :

  1. When i check the javascript SDK it\’s still not available yet, so… when it will be available?
  2. I try to use the REST api guide, and i have some problem with signin method, i currently use angular.js , i try the convert the curl and use $http :

 

Start your code here
curl -X POST -H \"Content-Type: application/json\" \\ -H \"X-Mesosfer-AppId: {AppId}\" \\ -H \"X-Mesosfer-AppKey: {AppKey}\" \\ -d \'{\"email\":\"valid@email.com\", \"password\":\"secretPassword\"}\' \\ https://api.mesosfer.com/api/v2/users/signin

my example code :

Start your code here
let setAppId = \"blablabla\"; let setAppKey = \"blablabla\"; $scope.signin = function(){ var url = \'https://api.mesosfer.com/api/v2/users/signin\'; return $http({ method: \"POST\", url: url, headers: { \"Content-Type\": \"application/json\", \"X-Mesosfer-AppId\": setAppId, \"X-Mesosfer-AppKey\": setAppKey }, data: { \"email\":\"myAnotherEmail@email.com\", \"password\": \"helo@email.com\" } }).then(function(response){ console.log(response); });}

and it throw out an error :
XMLHttpRequest cannot load https://api.mesosfer.com/api/v2/users/signin. Response to preflight request doesn\’t pass access control check: No \’Access-Control-Allow-Origin\’ header is present on the requested resource. Origin \’http://localhost:8100\’ is therefore not allowed access. The response had HTTP status code 404. ¬†
So how i supposed to cover this problem? I think maybe i was wrong about how to put the data, if that right then so how i should post the data?
If that\’s not the problem, please give me some clue or some sample code.
Any help is appreciated.
Thanks,
Abdul Muhit.

1 Answers
Best Answer
Hermawan Staff answered 7 months ago

Hi Abdul Muhit,

We have released new patch to fix some authentication issues.
Your code might be working now.
Please try again.

Currently, we are working to build sdk for javascript and other programming languages. We’ll let you know when it’s available.

Thanks,
Hermawan

Abdul Muhit replied 7 months ago

Ok, n yes it’s works now.
Thanks.

Abdul Muhit replied 7 months ago

Ok, n yes it’s works now.
Thanks.

Abdul Muhit replied 7 months ago

Ok, n yes it’s works now.
Thanks.

Your Answer