kobotoolbox REST services

94 views
Skip to first unread message

Iván Navarro 75

unread,
Oct 20, 2018, 4:20:44 AM10/20/18
to KoBoToolbox Users
Hi everyone,
I want to access the kobotoolbox REST services from my web (react web app) but when acesing the end-point I get a 'Access-Control-Allow-Origin' error.

login = (username, password) => {
const headers = new Headers()
headers.set(
'Authorization',
'Basic ' + Base64.encode(username + ':' + password)
)

method: 'GET',
headers: headers
}).then(response => response.json())
}

Where can I find an example to access the REST services from web?
I am completely new with kobotoolbox and I am sure I am doing something completely wrong.

Thanks!

Iván

Tino Kreutzer

unread,
Oct 22, 2018, 9:18:06 AM10/22/18
to kobo-...@googlegroups.com
Hi Ivan,
You need to change the subdomain to ‘kobo’ instead of ‘kc’. This token is provided by the kpi application, which is the new default API service. 

--
You received this message because you are subscribed to the Google Groups "KoBoToolbox Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kobo-users+...@googlegroups.com.
To post to this group, send email to kobo-...@googlegroups.com.
Visit this group at https://groups.google.com/group/kobo-users.
For more options, visit https://groups.google.com/d/optout.

Iván Navarro 75

unread,
Oct 22, 2018, 10:20:05 AM10/22/18
to kobo-...@googlegroups.com
Hi Tino,
thanks for you answer, I've just modified the URL for this one https://kobo.humanitarianresponse.info/token/?format=json and still receiving the same error.

Failed to load https://kobo.humanitarianresponse.info/token/?format=json: 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:3000' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Regards,

Iván

You received this message because you are subscribed to a topic in the Google Groups "KoBoToolbox Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kobo-users/vzk1eyD0U0Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kobo-users+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages