Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add realm to login function #56

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jes3rk
Copy link

@jes3rk jes3rk commented Apr 12, 2022

Notes

Came across an issue where users created in a non-default connection could not be authorized in testing.

What I did

  • Update the function in src/commands/get-user-tokens.js to call auth.client.login rather than auth.client.loginWithDefaultDirectory to enable specifying the realm property in the call.
  • Add default value for realm to "Username-Password-Authentication" as specified in the README.md to prevent breaking existing implementations.
  • Update README.md to include the new config variable auth0Realm.
  • Update README.md to remove breaking commas from example .env files.

How to test

  1. Create a new connection in auth0
  2. Enable the connection on your auth0 application
  3. Create a new user in auth0 that uses the connection created in step 1
  4. Update cypress.env.json with the new username/password and add auth0Realm: <your new connection name>
  5. Run tests

@jes3rk jes3rk changed the title Feat/add realm to login function feat: add realm to login function Apr 12, 2022
AUTH0_SECRET="DB208FHFQJFNNA28F0N1F8SBNF8B20FBA0BXSD29SSJAGSL12D9922929D",
AUTH0_SCOPE="openid profile email",
AUTH0_SESSION_COOKIE_NAME="appSession",
AUTH0_AUDIENCE="https://lyft.auth0.com/api/v2/"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for cleaning this up!

{
username,
password,
audience: Cypress.env('auth0Audience'),
scope: Cypress.env('auth0Scope'),
client_secret: Cypress.env('auth0ClientSecret'), // eslint-disable-line @typescript-eslint/camelcase
client_secret: Cypress.env('auth0ClientSecret'), // eslint-disable-line @typescript-eslint/camelcase,
realm: Cypress.env('auth0Realm') || 'Username-Password-Authentication',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't run the tests yet, since we need to add the correct env variables but this approach seems sane to me. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants