Install & Activate the OAuth 2.0 Add-on Module

This module will integrate ItsYou.online into your WHMCS installation for all user authentication.

Before you continu, make sure you have ItsYou.online correctly configured.

Installation and activation is achieved in 3 steps:

  • Step 1: Get the OAuth 2.0 Add-on Module from GitHub and deploy it
  • Step 2: Change the template WHMCS will use
  • Step 3: Activate the OAuth 2.0 add-on module

Also see the GitBook for this module: https://www.gitbook.com/book/gig/whmcs-oauth-2-0-add-on-module/details

Step 1: Get the OAuth 2.0 Add-on Module from GitHub and deploy it

First clone the 0-complexity/whmcs-oauth2-addon repository from GitHub on to your local machine.

It will come with following two deployment scripts in the src directory:

  • deploy.sh

      #!/usr/bin/env bash
      # First argument of this script should be the user password of the user with which you login on your Docker machine, hosting the Docker container
      # Second argument is of format username@docker_machine, e.g. [email protected]
      # Third argument is the SSH port of the Docker machine
      # Fourth argument is the name of the Docker container WHMCS is running in, e.g. whcms
      # Fifth argument should be 'debug' if you want to upload to the dev server
      set -euf
      rootpassword=$1
      remote_host=$2
      remote_ssh_port=$3
      container_name=$4
      debug=$5
      tar -cvzf custom_oauth2.tgz whmcs
      scp  -P ${remote_ssh_port} custom_oauth2.tgz ${remote_host}:/tmp/
      scp  -P ${remote_ssh_port} docker-deploy.sh ${remote_host}:/tmp/docker-deploy.sh
      ssh -p ${remote_ssh_port} -t ${remote_host} "echo $rootpassword | sudo -S -i bash /tmp/docker-deploy.sh ${container_name} ${debug}"
      rm -f custom_oauth2.tgz
    
  • docker-deploy.sh

      #!/usr/bin/env bash
      set -euf
      container_name=$1
      debug=$2
      cd /tmp
      rm -rf /tmp/whmcs
      tar -xvf custom_oauth2.tgz
      if [ ${debug} = 'debug' ]; then
          echo "Deploying to dev server"
          docker cp whmcs ${container_name}:/var/www/html/
      else
          mv whmcs html
          mv html/templates/itsyouonline html/templates/fusion
          docker cp html ${container_name}:/var/www/
      fi
      rm -rf html custom_oauth2 custom_oauth2.tgz docker-deploy.sh
    

Lookup the password of the cloudscalers user of the virtual machine hosting the WHMCS Docker container, and use it execute deploy.sh:

For the Moehaha.com WHMCS reference implementation we use following command:

bash deploy.sh <cloudscalers_password> [email protected] 2222 whmcs2 false

Step 2: Change the template WHMCS will use

Goto the Admin page of your WHMCS portal and select General Settings from the Setup menu/tab.

Here change the template from 'Six' to 'Fusion' (which a template acquired fron TemplateGenie):

Step 3: Activate the OAuth 2.0 Add-on Module

Goto the Admin page of your WHMCS portal and select Addon Modules from the Setup menu/tab.

Here you should see the OAuth 2.0, activate it:

Click the Configure button and specify using the following settings:

  • OAuth service base URL: https://itsyou.online
  • Authorize path:/v1/oauth/authorize
  • Token path: /v1/oauth/access_token
  • Identity path: /api/users/%s/info
  • JSON Web Token path: /v1/oauth/jwt
  • Client id: see the Itsyou.online configuration documentation
  • Client Secret: see the Itsyou.online configuration documentation
  • Scope: user:email:main,user:phone:main,user:address:main,user:name
  • Redirect URI: https://moehaha.com/index.php?m=custom_oauth2
  • OAuth provider name: It's You Online
  • Admin user: the WHMCS username under which identity the OAuth modele should operate
  • Access Control: select Full Adminnstrator and Sales Opeator

  • Click Save Changes

Next

Now that the OAuth 2.0 Add-on Module is installed, make sure that ItsYou.online is well configured, you should be able to visit the WHMCS site and register as a new user with ItsYou.online.

As a next step you will want to install the Cockpit Add-on module and configure the products.

results matching ""

    No results matching ""