✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🧬 Learn how to build RNA-Seq data apps with Python & Dash. Register for the May 20 Webinar!

Plotly OAuth auth.logout() Issue

There seems to be an issue with the implementation of the Plotly OAuth auth.logout() function.

The issue shows up when running:

import dash
import dash_auth
import dash_html_components as html
import os

os.environ['PLOTLY_USERNAME'] = '<your_username>'
os.environ['PLOTLY_API_KEY'] = '<your_api_key>'

APP_NAME = 'app_name'
APP_URL = 'http://127.0.0.1:8050/'
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
server = app.server

auth = dash_auth.PlotlyAuth(app, APP_NAME, 'private', APP_URL)

app.layout = html.Div([
    html.Div('TEST', id='div'),

    auth.create_logout_button(
            label='Sign out',
            redirect_to='https://google.com')
])

if __name__ == '__main__':
    app.run_server(debug=True)

Here is the debug:

Traceback (most recent call last):
  File "/anaconda3/envs/nanobox_env/lib/python3.7/site-packages/flask/app.py", line 2309, in __call__
    return self.wsgi_app(environ, start_response)
  File "/anaconda3/envs/nanobox_env/lib/python3.7/site-packages/flask/app.py", line 2295, in wsgi_app
    response = self.handle_exception(e)
  File "/anaconda3/envs/nanobox_env/lib/python3.7/site-packages/flask/app.py", line 1741, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/anaconda3/envs/nanobox_env/lib/python3.7/site-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/anaconda3/envs/nanobox_env/lib/python3.7/site-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/anaconda3/envs/nanobox_env/lib/python3.7/site-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/anaconda3/envs/nanobox_env/lib/python3.7/site-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/anaconda3/envs/nanobox_env/lib/python3.7/site-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/anaconda3/envs/nanobox_env/lib/python3.7/site-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/anaconda3/envs/nanobox_env/lib/python3.7/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/anaconda3/envs/nanobox_env/lib/python3.7/site-packages/dash_auth/oauth.py", line 187, in wrap
    response = f(*args, **kwargs)
  File "/anaconda3/envs/nanobox_env/lib/python3.7/site-packages/dash/dash.py", line 962, in dispatch
    return self.callback_map[target_id]['callback'](*args)
  File "/anaconda3/envs/nanobox_env/lib/python3.7/site-packages/dash/dash.py", line 902, in add_context
    output_value = func(*args, **kwargs)
  File "/anaconda3/envs/nanobox_env/lib/python3.7/site-packages/dash_auth/plotly_auth.py", line 224, in _on_log_out
    self.logout()
  File "/anaconda3/envs/nanobox_env/lib/python3.7/site-packages/dash_auth/plotly_auth.py", line 188, in logout
    invalidation_resp.raise_for_status()
  File "/anaconda3/envs/nanobox_env/lib/python3.7/site-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 502 Server Error: Bad Gateway for url: https://plot.ly/Auth/o/revoke_token/