Registration and DataPlug setup

Registration

First, you need to redirect the user to Hatters where they can give their consent to complete the registration.

You’ll need to build the URL using your Application ID, user’s email address and a callback URL. The URL will look similar to this:

https://hatters.dataswift.io/services/daas/signup?
application_id=<application-id>
&email=<email-address>
&redirect_uri=<callback_url>

Optional configuration query parameters:

  • lang - Defaults to ‘en’. In case you pass a different country code by using lang=, the application will appear localised to the requested language. eg. lang=pt

  • skip_deps - Defaults to ‘false’. Let’s assume an application is configured to have Facebook DataPlug as a dependency (i.e. application cannot function correctly without facebook data being available to it). The default platform behaviour is to first create a PDA and then automatically redirect the user to the Facebook OAuth flow for data synchronisation setup. We now support an option for the developer to skip the latter step by using skip_deps=true flag passed to the API as a query parameter. When the flag is added platform will create a PDA for the user, but will skip data synchronisation setup. User browser will be redirected to the calling application with access token attached as usual. However, in this case, it is up to the developer to decide how they want to handle data synchronisation setup going forward. Using a skip_deps=false flag or not specifying the query parameter at all will result in a default platform API behaviour.

Upon successful signup, the user will be redirected back to your application with the authentication token attached. This should be stored for subsequent API calls:

test-app://authenticate?token=eyJ0eXAiOiJKV1Qi….

Setup a DataPlug

Assuming you have skipped the dependency setup by setting the skip_deps=true and your application is configured to have Facebook DataPlug, you will need to include one extra step to start the data synchronization with the DataPlug.

First, you will need to retrieve the access token using your application token for the Facebook DataPlug that will be used only for the DataPlug setup:

GET - /api/v2.6/applications/facebook/access-token

Headers: x-auth-token:

Example Response:

{
"accessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhcHBsaWNhdG....",
"userId": "2b817eca-fdce-4fe1-a..."
}

Using the DataPlug’s access token and a callback URL to your App you can redirect the user to complete the setup process:

https://facebook.dataswift.io/authenticate/hat?
redirect=<callback-url>
&token=<data-plug-access-token>

Upon successful completion, the user will be redirected back to your application.