Skip to content

Commit 1fd6f14

Browse files
authored
chore: update auth examples to reflect RWA changes (#6335)
1 parent 2147a84 commit 1fd6f14

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

docs/app/guides/authentication-testing/amazon-cognito-authentication.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ const awsConfig = require('./aws-exports-es5.js')
163163
},
164164
setupNodeEvents(on, config) {
165165
on('task', {
166-
getAuthCredentials() {
166+
getCognitoCredentials() {
167167
const username = process.env.AWS_COGNITO_USERNAME
168168
const password = process.env.AWS_COGNITO_PASSWORD
169169
if (!username || !password) {
@@ -264,7 +264,7 @@ describe('Cognito, cy.origin() login', function () {
264264
cy.task('db:seed')
265265

266266
// login via Amazon Cognito via cy.origin()
267-
cy.task('getAuthCredentials').then(({ username, password }) => {
267+
cy.task('getCognitoCredentials').then(({ username, password }) => {
268268
cy.loginByCognito(username, password)
269269
})
270270
})
@@ -464,7 +464,7 @@ describe('Cognito, programmatic login', function () {
464464
cy.task('db:seed')
465465

466466
// Programmatically login via Amazon Cognito API
467-
cy.task('getAuthCredentials').then(({ username, password }) => {
467+
cy.task('getCognitoCredentials').then(({ username, password }) => {
468468
cy.loginByCognitoApi(username, password)
469469
})
470470
})

docs/app/guides/authentication-testing/auth0-authentication.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ require('dotenv').config()
9797
},
9898
setupNodeEvents(on, config) {
9999
on('task', {
100-
getAuthCredentials() {
100+
getAuth0Credentials() {
101101
const username = process.env.AUTH0_USERNAME
102102
const password = process.env.AUTH0_PASSWORD
103103
if (!username || !password) {
@@ -195,7 +195,7 @@ describe('Auth0', function () {
195195
cy.task('db:seed')
196196
cy.intercept('POST', '/graphql').as('createBankAccount')
197197

198-
cy.task('getAuthCredentials').then(({ username, password }) => {
198+
cy.task('getAuth0Credentials').then(({ username, password }) => {
199199
cy.loginToAuth0(username, password)
200200
})
201201
cy.visit('/')
@@ -342,7 +342,7 @@ onboarding process and logout.
342342
describe('Auth0', function () {
343343
beforeEach(function () {
344344
cy.task('db:seed')
345-
cy.task('getAuthCredentials').then(({ username, password }) => {
345+
cy.task('getAuth0Credentials').then(({ username, password }) => {
346346
cy.loginByAuth0Api(username, password)
347347
})
348348
})

docs/app/guides/authentication-testing/azure-active-directory-authentication.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ authentication workflow will enter an infinite redirect loop.
8282
},
8383
setupNodeEvents(on, config) {
8484
on('task', {
85-
getAuthCredentials() {
85+
getAADCredentials() {
8686
const username = process.env.AAD_USERNAME
8787
const password = process.env.AAD_PASSWORD
8888
if (!username || !password) {
@@ -157,7 +157,7 @@ function loginViaAAD(username: string, password: string) {
157157

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

202202
it('verifies the user logged in has the correct preferred name', () => {
203-
cy.task('getAuthCredentials').then(({ username }) => {
203+
cy.task('getAADCredentials').then(({ username }) => {
204204
cy.get('#table-body-div td:contains("preferred_username") + td').should(
205205
'contain',
206206
username
@@ -247,7 +247,7 @@ Cypress.Commands.add('loginToAAD', (username: string, password: string) => {
247247
// this is a very basic form of session validation for this demo.
248248
// depending on your needs, something more verbose might be needed
249249
cy.visit('http://localhost:3000')
250-
cy.task('getAuthCredentials').then(({ username }) => {
250+
cy.task('getAADCredentials').then(({ username }) => {
251251
cy.get('#welcome-div').should('contain', `Welcome ${username}!`)
252252
})
253253
},

docs/app/guides/authentication-testing/google-authentication.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,15 @@ require('dotenv').config()
105105
```js
106106
{
107107
env: {
108-
googleClientId: process.env.REACT_APP_GOOGLE_CLIENTID,
108+
googleClientId: process.env.VITE_GOOGLE_CLIENTID,
109109
},
110110
setupNodeEvents(on, config) {
111111
on('task', {
112-
getGoogleAuthCredentials() {
113-
const clientSecret = process.env.REACT_APP_GOOGLE_CLIENT_SECRET
112+
getGoogleCredentials() {
113+
const clientSecret = process.env.VITE_GOOGLE_CLIENT_SECRET
114114
const refreshToken = process.env.GOOGLE_REFRESH_TOKEN
115115
if (!clientSecret || !refreshToken) {
116-
throw new Error('REACT_APP_GOOGLE_CLIENT_SECRET and GOOGLE_REFRESH_TOKEN must be set')
116+
throw new Error('VITE_GOOGLE_CLIENT_SECRET and GOOGLE_REFRESH_TOKEN must be set')
117117
}
118118
return { clientSecret, refreshToken }
119119
},
@@ -145,7 +145,7 @@ The `loginByGoogleApi` command will execute the following steps:
145145
```jsx title="cypress/support/commands.js"
146146
Cypress.Commands.add('loginByGoogleApi', () => {
147147
cy.log('Logging in to Google')
148-
cy.task('getGoogleAuthCredentials').then(({ clientSecret, refreshToken }) => {
148+
cy.task('getGoogleCredentials').then(({ clientSecret, refreshToken }) => {
149149
cy.request({
150150
method: 'POST',
151151
url: 'https://www.googleapis.com/oauth2/v4/token',

docs/app/guides/authentication-testing/okta-authentication.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ require('dotenv').config()
5151
},
5252
setupNodeEvents(on, config) {
5353
on('task', {
54-
getAuthCredentials() {
55-
const username = process.env.AUTH_USERNAME
56-
const password = process.env.AUTH_PASSWORD
54+
getOktaCredentials() {
55+
const username = process.env.OKTA_USERNAME
56+
const password = process.env.OKTA_PASSWORD
5757
if (!username || !password) {
58-
throw new Error('AUTH_USERNAME and AUTH_PASSWORD must be set')
58+
throw new Error('OKTA_USERNAME and OKTA_PASSWORD must be set')
5959
}
6060
return { username, password }
6161
},
@@ -131,7 +131,7 @@ is in the <Icon name="github" inline="true" contentType="rwa" />.
131131
describe('Okta', function () {
132132
beforeEach(function () {
133133
cy.task('db:seed')
134-
cy.task('getAuthCredentials').then(({ username, password }) => {
134+
cy.task('getOktaCredentials').then(({ username, password }) => {
135135
cy.loginByOkta(username, password)
136136
})
137137
})
@@ -251,7 +251,7 @@ process and logout.
251251
describe('Okta', function () {
252252
beforeEach(function () {
253253
cy.task('db:seed')
254-
cy.task('getAuthCredentials').then(({ username, password }) => {
254+
cy.task('getOktaCredentials').then(({ username, password }) => {
255255
cy.loginByOktaApi(username, password)
256256
})
257257
})

0 commit comments

Comments
 (0)