Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ const awsConfig = require('./aws-exports-es5.js')
},
setupNodeEvents(on, config) {
on('task', {
getAuthCredentials() {
getCognitoCredentials() {
const username = process.env.AWS_COGNITO_USERNAME
const password = process.env.AWS_COGNITO_PASSWORD
if (!username || !password) {
Expand Down Expand Up @@ -264,7 +264,7 @@ describe('Cognito, cy.origin() login', function () {
cy.task('db:seed')

// login via Amazon Cognito via cy.origin()
cy.task('getAuthCredentials').then(({ username, password }) => {
cy.task('getCognitoCredentials').then(({ username, password }) => {
cy.loginByCognito(username, password)
})
})
Expand Down Expand Up @@ -464,7 +464,7 @@ describe('Cognito, programmatic login', function () {
cy.task('db:seed')

// Programmatically login via Amazon Cognito API
cy.task('getAuthCredentials').then(({ username, password }) => {
cy.task('getCognitoCredentials').then(({ username, password }) => {
cy.loginByCognitoApi(username, password)
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ require('dotenv').config()
},
setupNodeEvents(on, config) {
on('task', {
getAuthCredentials() {
getAuth0Credentials() {
const username = process.env.AUTH0_USERNAME
const password = process.env.AUTH0_PASSWORD
if (!username || !password) {
Expand Down Expand Up @@ -195,7 +195,7 @@ describe('Auth0', function () {
cy.task('db:seed')
cy.intercept('POST', '/graphql').as('createBankAccount')

cy.task('getAuthCredentials').then(({ username, password }) => {
cy.task('getAuth0Credentials').then(({ username, password }) => {
cy.loginToAuth0(username, password)
})
cy.visit('/')
Expand Down Expand Up @@ -342,7 +342,7 @@ onboarding process and logout.
describe('Auth0', function () {
beforeEach(function () {
cy.task('db:seed')
cy.task('getAuthCredentials').then(({ username, password }) => {
cy.task('getAuth0Credentials').then(({ username, password }) => {
cy.loginByAuth0Api(username, password)
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ authentication workflow will enter an infinite redirect loop.
},
setupNodeEvents(on, config) {
on('task', {
getAuthCredentials() {
getAADCredentials() {
const username = process.env.AAD_USERNAME
const password = process.env.AAD_PASSWORD
if (!username || !password) {
Expand Down Expand Up @@ -157,7 +157,7 @@ function loginViaAAD(username: string, password: string) {

// Ensure Microsoft has redirected us back to the sample app with our logged in user.
cy.url().should('equal', 'http://localhost:3000/')
cy.task('getAuthCredentials').then(({ username }) => {
cy.task('getAADCredentials').then(({ username }) => {
cy.get('#welcome-div').should(
'contain',
`Welcome ${username}!`
Expand Down Expand Up @@ -187,7 +187,7 @@ as a user via Azure Active Directory and run a basic sanity check.
describe('Azure Active Directory Authentication', () => {
beforeEach(() => {
// log into Azure Active Directory through our sample SPA using our custom command
cy.task('getAuthCredentials').then(({ username, password }) => {
cy.task('getAADCredentials').then(({ username, password }) => {
cy.loginToAAD(username, password)
})
cy.visit('http://localhost:3000')
Expand All @@ -200,7 +200,7 @@ describe('Azure Active Directory Authentication', () => {
})

it('verifies the user logged in has the correct preferred name', () => {
cy.task('getAuthCredentials').then(({ username }) => {
cy.task('getAADCredentials').then(({ username }) => {
cy.get('#table-body-div td:contains("preferred_username") + td').should(
'contain',
username
Expand Down Expand Up @@ -247,7 +247,7 @@ Cypress.Commands.add('loginToAAD', (username: string, password: string) => {
// this is a very basic form of session validation for this demo.
// depending on your needs, something more verbose might be needed
cy.visit('http://localhost:3000')
cy.task('getAuthCredentials').then(({ username }) => {
cy.task('getAADCredentials').then(({ username }) => {
cy.get('#welcome-div').should('contain', `Welcome ${username}!`)
})
},
Expand Down
10 changes: 5 additions & 5 deletions docs/app/guides/authentication-testing/google-authentication.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ require('dotenv').config()
```js
{
env: {
googleClientId: process.env.REACT_APP_GOOGLE_CLIENTID,
googleClientId: process.env.VITE_GOOGLE_CLIENTID,
},
setupNodeEvents(on, config) {
on('task', {
getGoogleAuthCredentials() {
const clientSecret = process.env.REACT_APP_GOOGLE_CLIENT_SECRET
getGoogleCredentials() {
const clientSecret = process.env.VITE_GOOGLE_CLIENT_SECRET
const refreshToken = process.env.GOOGLE_REFRESH_TOKEN
if (!clientSecret || !refreshToken) {
throw new Error('REACT_APP_GOOGLE_CLIENT_SECRET and GOOGLE_REFRESH_TOKEN must be set')
throw new Error('VITE_GOOGLE_CLIENT_SECRET and GOOGLE_REFRESH_TOKEN must be set')
}
return { clientSecret, refreshToken }
},
Expand Down Expand Up @@ -145,7 +145,7 @@ The `loginByGoogleApi` command will execute the following steps:
```jsx title="cypress/support/commands.js"
Cypress.Commands.add('loginByGoogleApi', () => {
cy.log('Logging in to Google')
cy.task('getGoogleAuthCredentials').then(({ clientSecret, refreshToken }) => {
cy.task('getGoogleCredentials').then(({ clientSecret, refreshToken }) => {
cy.request({
method: 'POST',
url: 'https://www.googleapis.com/oauth2/v4/token',
Expand Down
12 changes: 6 additions & 6 deletions docs/app/guides/authentication-testing/okta-authentication.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ require('dotenv').config()
},
setupNodeEvents(on, config) {
on('task', {
getAuthCredentials() {
const username = process.env.AUTH_USERNAME
const password = process.env.AUTH_PASSWORD
getOktaCredentials() {
const username = process.env.OKTA_USERNAME
const password = process.env.OKTA_PASSWORD
if (!username || !password) {
throw new Error('AUTH_USERNAME and AUTH_PASSWORD must be set')
throw new Error('OKTA_USERNAME and OKTA_PASSWORD must be set')
}
return { username, password }
},
Expand Down Expand Up @@ -131,7 +131,7 @@ is in the <Icon name="github" inline="true" contentType="rwa" />.
describe('Okta', function () {
beforeEach(function () {
cy.task('db:seed')
cy.task('getAuthCredentials').then(({ username, password }) => {
cy.task('getOktaCredentials').then(({ username, password }) => {
cy.loginByOkta(username, password)
})
})
Expand Down Expand Up @@ -251,7 +251,7 @@ process and logout.
describe('Okta', function () {
beforeEach(function () {
cy.task('db:seed')
cy.task('getAuthCredentials').then(({ username, password }) => {
cy.task('getOktaCredentials').then(({ username, password }) => {
cy.loginByOktaApi(username, password)
})
})
Expand Down