Skip to content

Commit c2564a8

Browse files
author
Steve Hobbs
authored
New auth0-spa-js samples (#124)
* New samples for auth0-spa-js * Removed tutorials from readmes * More updates based on feedback - removed docs folders - added redirect url to logout calls * Renamed 'redirect_uri' to 'returnTo' * Removed now artifacts
1 parent 22b6d6a commit c2564a8

178 files changed

Lines changed: 23503 additions & 100894 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/config.yml

Lines changed: 42 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,45 @@
11
# Environment variables to be defined in the build configuration:
22
# AUTH0_TEST_CLIENT_ID = Client id to use in test
33
# AUTH0_TEST_DOMAIN = Domain to use in test
4-
# AUTH0_TEST_API_IDENTIFIER = API Audience to use in test
4+
# AUTH0_TEST_AUDIENCE = API Audience to use in test
55

66
# Common logic
77
defaults: &defaults
8-
steps:
9-
- attach_workspace:
10-
at: ~/
11-
- run:
12-
name: Replace Auth0 test credentials
13-
command: |
14-
echo "export const AUTH_CONFIG = {" >> $AUTH0_CFG
15-
echo " clientID: '$AUTH0_TEST_CLIENT_ID'," >> $AUTH0_CFG
16-
echo " domain: '$AUTH0_TEST_DOMAIN'," >> $AUTH0_CFG
17-
echo " callbackUrl: 'http://localhost:3000/callback'," >> $AUTH0_CFG
18-
echo " apiUrl: '$AUTH0_TEST_AUDIENCE'" >> $AUTH0_CFG
19-
echo "}" >> $AUTH0_CFG
8+
steps:
9+
- attach_workspace:
10+
at: ~/
11+
- run:
12+
name: Replace Auth0 test credentials
13+
command: |
14+
echo "{ \"domain\": \"$AUTH0_TEST_DOMAIN\", \"clientId\": \"$AUTH0_TEST_CLIENT_ID\", \"audience\": \"$AUTH0_TEST_API_IDENTIFIER\" }" > $AUTH0_CFG
2015
21-
- run:
22-
name: Build pull request
23-
command: |
24-
docker build -t $CIRCLE_JOB ./$SAMPLE_PATH
25-
docker run -d -p 3000:3000 --name $CIRCLE_SHA1 -e AUTH0_DOMAIN=$AUTH0_TEST_DOMAIN -e AUTH0_AUDIENCE=$AUTH0_TEST_API_IDENTIFIER $CIRCLE_JOB
26-
- run:
27-
name: Wait for app to be available
28-
command: |
29-
sleep 10
30-
docker run --network host --rm appropriate/curl --retry 8 --retry-connrefused -v localhost:3000
31-
- run:
32-
name: Run tests
33-
command: |
34-
docker create --network host --name tester codeception/codeceptjs codeceptjs run-multiple --all --steps --verbose
35-
docker cp $(pwd)/lock_login_test.js tester:/tests/lock_login_test.js
36-
docker cp $(pwd)/codecept.conf.js tester:/tests/codecept.conf.js
37-
docker start -i tester
38-
working_directory: scripts
39-
- run:
40-
name: Copy app container logs
41-
command: |
42-
mkdir -p /tmp/out
43-
docker logs $CIRCLE_SHA1 > /tmp/out/app_logs.log
44-
docker cp tester:/tests/out /tmp/
45-
when: on_fail
46-
- store_artifacts:
47-
path: /tmp/out
16+
- run:
17+
name: Build pull request
18+
command: |
19+
docker build -t $CIRCLE_JOB ./$SAMPLE_PATH
20+
docker run -d -p 3000:3000 --name $CIRCLE_SHA1 $CIRCLE_JOB
21+
- run:
22+
name: Wait for app to be available
23+
command: |
24+
sleep 10
25+
docker run --network host --rm appropriate/curl --retry 8 --retry-connrefused -v localhost:3000
26+
- run:
27+
name: Run tests
28+
command: |
29+
docker create --network host --name tester codeception/codeceptjs codeceptjs run-multiple --all --steps --verbose
30+
docker cp $(pwd)/lock_login_spa_test.js tester:/tests/lock_login_test.js
31+
docker cp $(pwd)/codecept.conf.js tester:/tests/codecept.conf.js
32+
docker start -i tester
33+
working_directory: scripts
34+
- run:
35+
name: Copy app container logs
36+
command: |
37+
mkdir -p /tmp/out
38+
docker logs $CIRCLE_SHA1 > /tmp/out/app_logs.log
39+
docker cp tester:/tests/out /tmp/
40+
when: on_fail
41+
- store_artifacts:
42+
path: /tmp/out
4843

4944
# Jobs and Workflows
5045
version: 2
@@ -62,32 +57,15 @@ jobs:
6257
01-login:
6358
machine: true
6459
environment:
65-
- AUTH0_CFG: 01-Login/src/Auth/auth0-variables.js
60+
- AUTH0_CFG: 01-Login/src/auth_config.json
6661
- SAMPLE_PATH: 01-Login
6762
<<: *defaults
68-
02-user-profile:
69-
machine: true
70-
environment:
71-
- AUTH0_CFG: 02-User-Profile/src/Auth/auth0-variables.js
72-
- SAMPLE_PATH: 02-User-Profile
73-
<<: *defaults
74-
03-calling-an-api:
75-
machine: true
76-
environment:
77-
- AUTH0_CFG: 03-Calling-an-API/src/Auth/auth0-variables.js
78-
- SAMPLE_PATH: 03-Calling-an-API
79-
<<: *defaults
80-
04-authorization:
81-
machine: true
82-
environment:
83-
- AUTH0_CFG: 04-Authorization/src/Auth/auth0-variables.js
84-
- SAMPLE_PATH: 04-Authorization
85-
<<: *defaults
86-
05-token-renewal:
63+
64+
02-api:
8765
machine: true
8866
environment:
89-
- AUTH0_CFG: 05-Token-Renewal/src/Auth/auth0-variables.js
90-
- SAMPLE_PATH: 05-Token-Renewal
67+
- AUTH0_CFG: 02-Calling-an-API/src/auth_config.json
68+
- SAMPLE_PATH: 02-Calling-an-API
9169
<<: *defaults
9270

9371
workflows:
@@ -100,19 +78,8 @@ workflows:
10078
context: Quickstart SPA Test
10179
requires:
10280
- checkout
103-
- 02-user-profile:
104-
context: Quickstart SPA Test
105-
requires:
106-
- checkout
107-
- 03-calling-an-api:
108-
context: Quickstart SPA Test
109-
requires:
110-
- checkout
111-
- 04-authorization:
112-
context: Quickstart SPA Test
113-
requires:
114-
- checkout
115-
- 05-token-renewal:
81+
82+
- 02-api:
11683
context: Quickstart SPA Test
11784
requires:
11885
- checkout

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @luisrudge
1+
* @luisrudge @davidpatrick

01-Login/.dockerignore

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
1-
package-lock.json
2-
node_modules
3-
.gitignore
4-
exec.sh
5-
exec.ps1
6-
README.md
1+
.git

01-Login/.gitignore

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
1-
# See http://help.github.com/ignore-files/ for more about ignoring files.
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
22

33
# dependencies
4-
node_modules
4+
/node_modules
5+
/.pnp
6+
.pnp.js
57

68
# testing
7-
coverage
9+
/coverage
810

911
# production
10-
build
12+
/build
1113

1214
# misc
1315
.DS_Store
14-
.env
15-
npm-debug.log
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*
24+
25+
auth_config.json

01-Login/Dockerfile

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,38 @@
1-
FROM node:8.7-alpine
1+
FROM node:10-alpine as build
22

3-
WORKDIR /home/app
3+
RUN apk update && apk upgrade && \
4+
apk add --no-cache bash git openssh yarn
45

5-
ADD package.json /home/app
6-
RUN npm install
7-
ADD . /home/app
6+
RUN mkdir /app
87

9-
CMD ["npm", "start"]
8+
WORKDIR /app
9+
10+
COPY package.json .
11+
12+
RUN yarn install
13+
14+
COPY . .
15+
16+
RUN yarn build
17+
18+
# ---------------
19+
20+
FROM node:10-alpine
21+
22+
RUN mkdir -p /app/build
23+
24+
RUN apk update && apk upgrade && apk add yarn git
25+
26+
WORKDIR /app
27+
28+
COPY --from=build /app/build ./build
29+
COPY --from=build /app/package.json .
30+
COPY --from=build /app/server.js .
31+
32+
ENV NODE_ENV production
33+
34+
RUN yarn install --production
1035

1136
EXPOSE 3000
37+
38+
CMD ["node", "server.js"]

0 commit comments

Comments
 (0)