1

Enable secure mode

Reach out to Village support to activate secure mode and enforce a more robust authentication flow, ensuring only verified users can integrate with Village.

By enabling secure mode, identifying users without an authorization token will be immediately deprecated. Ensure your integration is updated to authenticate users exclusively via tokens to maintain compatibility.

2

Generate a token to authorize the user

In your server, send a request to the Village API to create a token to authorize the user. Check the API Reference for more details.

curl --request GET \
  --url https://api.village.do/v1/users/authorization \
  --header 'secret-key: <api-key>' \
  --header 'user-identifier: YOUR_UNIQUE_USER_IDENTIFIER'

Generating an authorization token does not automatically provision a new user or impact billing. A user is only added as a provisioned user once they initiate their network sync.

3

Initialize the SDK

Copy the snippet below to add the Village SDK to your application. You should use the generate token from the previous step.

<script>
 (function(){var w=window;var d=document;var v=w.Village||{};d.head.appendChild(Object.assign(d.createElement("style"),{textContent:'[village-paths-availability="found"],[village-paths-availability="not-found"]{display:none}'}));v.q=v.q||[];v._call=function(method,args){v.q.push([method,args])};v.init=function(){v._call("init",arguments)};v.identify=function(){v._call("authorize",arguments)};w.Village=v;var l=function(){var s=d.createElement("script");s.type="text/javascript";s.async=true;s.src="https://js.village.do";var x=d.getElementsByTagName("script")[0];x.parentNode.insertBefore(s,x)};if(w.Village.loaded)return;if(w.attachEvent){w.attachEvent("onload",l)}else{w.addEventListener("load",l,false)}w.Village.loaded=true})();
	Village.init('VILLAGE_PUBLIC_KEY');
	Village.authorize('GENERATED_TOKEN');
</script>
4

🎉 Go live!