How to setup the site to use the mobile app?

Setting the site to use the mobile app is quite easy and can be completed within few minutes. Please follow below steps.

Make sure your travel website ( for e.g. http://examplesite.com) is live and trips are managed from our WP Travel plugin. If you’ve not yet installed it, you can start by downloading it now.

After your WordPress site with WP Travel plugin is ready, follow the app installation steps as given below.

Step 1: #

Install the plugin JWT Authentication for WP REST API. You can download it from below link:

https://wordpress.org/plugins/jwt-authentication-for-wp-rest-api/embed/#?secret=tz2yueeEzR

Installation: #

There are mainly two ways of installing the plugin.

  1. Using the WordPress dashboard:
    • Navigate to the ‘Add New’ in the plugins dashboard
    • Search for ‘jwt-authentication-for-wp-rest-api’
    • Click ‘Install Now’
    • Activate the plugin on the Plugin dashboard
  2. Uploading in WordPress dashboard:
    • Navigate to the ‘Add New’ in the plugins dashboard
    • Navigate to the ‘Upload’ area
    • Select jwt-authentication-for-wp-rest-api.zip from your computer
    • Click ‘Install Now’
    • Activate the plugin in the Plugin dashboard

Step 2 : #

After the activating the plugin, you need to define the constant.

The JWT needs a secret key to sign the token this secret key must be unique and never revealed.

To add the secret key edit your wp-config.php file and add a new constant called JWT_AUTH_SECRET_KEY

define(‘JWT_AUTH_SECRET_KEY’, ‘your-top-secret-key’);

You can get the secret key from the “WordPress Salt Key Generator – WordPress API – WordPress.org

This image has an empty alt attribute; its file name is app-secret-key.png

Just replace the key in place of “your-top-secret-key” from above code snippet.

For example, select any of the key as shown in the screenshot and add in the code snippet.

define('JWT_AUTH_SECRET_KEY', '2Uh;U{d1pCUUrq|$kDkv dyj=M4@Q|CZ<++-6%dt+TpUmKN!8U,k-<R,0sM-X%&S');

Note: If the app still does not work then, please go through below additional step as well.

Enable PHP HTTP Authorization Header: #

Shared Hosts: #

Most shared hosts have disabled the HTTP Authorization Header by default.

To enable this option you’ll need to edit your .htaccess file by adding the following:

RewriteEngine on
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]

OR #

WPEngine: #

To enable this option you’ll need to edit your .htaccess file by adding the following (see https://github.com/Tmeister/wp-api-jwt-auth/issues/1):

SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1


Step 3: #

The final step is to download the zip file “wp-travel-rest-api” from the link given below and activate in your site.

https://www.wptravel.io/downloads/wp-travel-rest-api/embed/

Screenshot:

This image has an empty alt attribute; its file name is wp-travel-app-rest-api.png

Finally, you are ready to use your app.

Powered by BetterDocs