Hi,
Has anyone recently used dash_google_auth and/or dash_okta_auth with success?
I was able to make oauth work with okta but not with google.
For okta, the code is the following:
from dash_okta_auth import OktaOAuth
server = Flask(name)
server.config.update({
‘OKTA_OAUTH_CLIENT_ID’: ‘XXXXXXXXXX’,
‘OKTA_OAUTH_CLIENT_SECRET’: ‘XXXXXXXXXXXXX’,
})
server.secret_key = os.environ.get(“FLASK_SECRET_KEY”, “anythinggoes”)
os.environ[‘OAUTHLIB_INSECURE_TRANSPORT’] = ‘1’
app = dash.Dash(name, server=server, url_base_pathname=’/’)
scopes =
auth = OktaOAuth(app, base_url=‘https://dev-xxxxxx.okta.com’, additional_scopes=scopes)
One possible configuration for the Login redirect URIs at okta is http://xxxxxxxxxxx/login/okta/authorized
The prescribed code for google auth is the following:
server.config.update({
‘GOOGLE_OAUTH_CLIENT_ID’: ‘xxxxxxxxxxxxxxxxxxxxxx’,
‘GOOGLE_OAUTH_CLIENT_SECRET’: ‘xxxxxxxxxxxxxxxxxx’,
})
server.secret_key = os.environ.get(“FLASK_SECRET_KEY”, “supersikrit”)
os.environ[‘OAUTHLIB_INSECURE_TRANSPORT’] = ‘1’
app = dash.Dash(name, server=server, url_base_pathname=’/’)
emails = [‘xxxxxxxx@gmail.com’’]
scopes =
auth = GoogleOAuth(app=app, authorized_emails=emails, additional_scopes=scopes)
One possible configuration for the Login redirect URIs at google is http://xxxxxxxxxxx/login/google/authorized
The problem with google is that after the login I always get redirected back to the login
http://xxxxxxxxxxx/login/google/authorized
and the server throws an internal server error (500)
I tried to change the base url by doing
app = dash.Dash(name, server=server, url_base_pathname=’/mydashapp/’)
@server.route(’/mydashapp’)
def MyDashApp():
return app.index()
but it still doesn’t work and it gives the same error-- also, I’m not very familiar with Flask, to be honest.
Any help solving this issue? I’ve lost the entire day trying to make this work.