question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using AWSCognito and unable to get environment for DOMAIN

See original GitHub issue

So i’m using TLJH

Running the config

root@ip-172-*.*.*:/home/ubuntu# tljh-config show
users:
  admin:
  - insightadmin
auth:
  type: oauthenticator.awscognito.AWSCognitoAuthenticator

With this config…

root@ip-172.*.*.*:/home/ubuntu# cat /opt/tljh/config/jupyterhub_config.d/awscognito.py
c.AWSCognitoAuthenticator.client_id=‘********’
c.AWSCognitoAuthenticator.client_secret=‘********’
c.AWSCognitoAuthenticator.oauth_callback_url='https://myhub/hub/oauth_callback'
c.AWSCognitoAuthenticator.username_key='username'
c.AWSCognitoAuthenticator.oauth_logout_redirect_url='https://myhub/hub/logout
root@ip-172-*.*.*:/home/ubuntu# printenv | grep AWS
AWSCOGNITO_DOMAIN=myhub.auth.eu-west-1.amazoncognito.com

When I hit the site, it doesn’t pick up the environment variable and I get

https://none/oauth2/authorize?response_type=code&redirect_uri=

If I hard code the url into

https://github.com/jupyterhub/oauthenticator/blob/master/oauthenticator/awscognito.py#L53

i.e. change

AWSCOGNITO_DOMAIN = os.getenv('AWSCOGNITO_DOMAIN')

to

AWSCOGNITO_DOMAIN = 'myhub.auth.eu-west-1.amazoncognito.com'

It works fine, where am I missing setting the environment variable ?

I’ve tried it in /etc/environment and running

export AWSCOGNITO_DOMAIN=myhub.auth.eu-west-1.amazoncognito.com'

all to no avail…

And testing it in python gives

root@ip-172-*.*.*:/home/ubuntu# python3
Python 3.6.9 (default, Nov  7 2019, 10:44:02)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> print(os.getenv('AWSCOGNITO_DOMAIN'))
myhub.auth.eu-west-1.amazoncognito.com

Any help would be great.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
budgestercommented, Dec 3, 2019

I’ll create a howto on TLJH docs over the next couple of days.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configure the Amazon Cognito hosted web UI
In the Amazon Cognito console, choose User pools, and then choose your user pool. · Under App integration, choose Domain name, and then...
Read more >
Configuring a Custom Domain with Cognito | A Cloud Guru
Navigate to the user pool. Under App integration, select Domain name. Choose Use your domain. Use auth.<labdomain> (where <labdomain> ...
Read more >
Cognito own domain name required A Record - Stack Overflow
9 Answers 9 · Sign in to the Route 53 console. · If you don't have a hosted zone in Route 53, set...
Read more >
Custom domain support with Cognito · Issue #1880 - GitHub
We configured custom domain for cognito hosted UI and when user tries to login it calls both cognito domain (ending up with invalid_grant...
Read more >
User authentication with AWS Cognito: The good, the bad and ...
You can only make mistakes. With a managed service you don't need to care about the passwords of your users, security protocols, or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found