Introduction
This document describe how to auto-generate the OAuth Token for Webex integrations without human intervention.
Requirements
- Webex account and access to developer.webex.com
- Cloud Instance or Server with public IP address and port 5007 open
- Python 3
- Firefox
Lab Components
This guide is based in the following environment:
- Azure Cloud Linux (almalinux 8.5)
- Python 3.6.8
Configuration
- Linux Terminal:
sudo yum -y update
sudo yum -y install firefox git
pip3 install requests
pip3 install selenium
pip3 install flask
pip3 install pyopenssl
git clone https://github.com/hheisego/Webex-OAUTH.git
Download and unpack Selenium
in the root application folder:
wget https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz
tar -xf geckodriver-v0.30.0-linux64.tar.gz
Create the integration
Script Configuration
wbx-integration.py
import requests
from flask import Flask, render_template, request
import json
clientID = "C714b104c6dda60bbb378bb7e"
secretID = "4a8995bcb5b94f2ff782328afc"
redirectURI = "https://<your server ip or domain>:5007/oauth"
...
if state == "HELMUT_STRING":
templates/index.html
<a id="grant1" href="https://webexapis.com/v1/authorize?client_id=C71e8ad2764e083bf8bcec19b9c89&response_type=code&redirect_uri=https%3A%2F%2Fyourdomain.online%3A5007%2Foauth&scope=spark-admin%3Abroadworks_subscribers_write%20meeting%3Aadmin_preferences_write%20spark%3Aall%20meeting%3Aadmin_preferences_read%20analytics%3Aread_all%20meeting%3Aadmin_participcompliance%3Arooms_write%20spark%3Aplaces_write&state=HELMUT_STRING">
<input type="button" id="grant-button" value="authorize it now">
</a>
autoken-refresh.py
browser.get('https://<your server ip or domain>:5007/')
...
get_token(webex_user="webexaccount@mailservice.com", password="webexpassword")
Verification