Connecting to Ushahidi mobile app
Configure your deployment to support the mobile app
First, it is necessary to edit the file config.json
{
client_id: "ushahidiui",
client_secret: "35e7f0bca957836d05ca0492211b0ac707671261",
backend_url: "",
google_analytics_id: "",
intercom_app_id: "",
mapbox_api_key: "",
raven_url: ""
}
The following are the required settings to allow for mobile app support:
client_id: this is the oauth client id that allows the mobile app to identify itself to your deployment’s API instance. If you have not explicitly changed it then the default value is ‘ushahidiui’
client_secret: this is the oauth client secret, the second property that the mobile client uses to identify itself to the API instance. If you have not explicitly changed it then the default value is ‘35e7f0bca957836d05ca0492211b0ac707671261’
backend_url: this should be set to the uri of the location of your API instance. For example, if your client is hosted at ‘name.domain.com’ and your API is hosted at ‘name.api.domain.com’, then the value for this field should be ‘name.api.domain.com’
Optional properties:
google_analytics_id: if you have a Google Analytics account and you wish for the Mobile App to log information to it then you should specify your google analytics id here.
intercom_app_id: if you have an Intercom account and you wish to provide intercom support for your users then you can specify your Intercom app id here.
mapbox_api_key: if you wish to use your own map box key, it can be set here
raven_url: if you are using Sentry and wish to have the mobile app send any issues to your Sentry account then you can set the appropriate raven url here.
CORS headers
It's necessary to configure your web server to serve the config.json file along with a series of HTTP headers. Here are the headers:
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range
Access-Control-Expose-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range
The exact way to accomplish this depends on the specific kind of web server that you are using.
Test your deployment to with the mobile app
First, it is necessary to edit the file config.json
{
client_id: "ushahidiui",
client_secret: "35e7f0bca957836d05ca0492211b0ac707671261",
backend_url: "",
google_analytics_id: "",
intercom_app_id: "",
mapbox_api_key: "",
raven_url: ""
}
The following are the required settings to allow for mobile app support:
client_id: this is the oauth client id that allows the mobile app to identify itself to your deployment’s API instance. If you have not explicitly changed it then the default value is ‘ushahidiui’
client_secret: this is the oauth client secret, the second property that the mobile client uses to identify itself to the API instance. If you have not explicitly changed it then the default value is ‘35e7f0bca957836d05ca0492211b0ac707671261’
backend_url: this should be set to the uri of the location of your API instance. For example, if your client is hosted at ‘name.domain.com’ and your API is hosted at ‘name.api.domain.com’, then the value for this field should be ‘name.api.domain.com’
Optional properties:
google_analytics_id: if you have a Google Analytics account and you wish for the Mobile App to log information to it then you should specify your google analytics id here.
intercom_app_id: if you have an Intercom account and you wish to provide intercom support for your users then you can specify your Intercom app id here.
mapbox_api_key: if you wish to use your own map box key, it can be set here
raven_url: if you are using Sentry and wish to have the mobile app send any issues to your Sentry account then you can set the appropriate raven url here.
CORS headers
It's necessary to configure your web server to serve the config.json file along with a series of HTTP headers. Here are the headers:
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range
Access-Control-Expose-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range
The exact way to accomplish this depends on the specific kind of web server that you are using.