Skip to content

Commit 605ee8f

Browse files
committed
feat: update introspection route and related references to use new OAuth path
1 parent 39036ab commit 605ee8f

File tree

16 files changed

+55
-16
lines changed

16 files changed

+55
-16
lines changed

epicshop/epic-me/app/routes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ export default [
55
route('/authorize', 'routes/authorize.tsx'),
66
route('/healthcheck', 'routes/healthcheck.tsx'),
77
route('/db-api', 'routes/db-api.tsx'),
8-
route('/introspect', 'routes/introspect.ts'),
8+
route('/oauth/introspection', 'routes/oauth/introspection.ts'),
99
route('/test-auth', 'routes/test-auth.tsx'),
1010
] satisfies RouteConfig

epicshop/epic-me/app/routes/introspect.ts renamed to epicshop/epic-me/app/routes/oauth/introspection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { invariantResponse } from '@epic-web/invariant'
22
import { type Token } from '#types/helpers'
3-
import { type Route } from './+types/introspect'
3+
import { type Route } from './+types/introspection.ts'
44

55
export async function action({ request, context }: Route.LoaderArgs) {
66
const token = (await request.formData()).get('token')?.toString()

exercises/03.auth-info/01.problem.introspect/src/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { EPIC_ME_AUTH_SERVER_URL } from './client.ts'
1111
// 🐨 export an async function called getAuthInfo that accepts the request
1212
// 🐨 if the request has an Authorization header, get the token from it
1313
// if it doesn't, return null
14-
// 🐨 construct a URL pointing to `/introspect` on the auth server
14+
// 🐨 construct a URL pointing to `/oauth/introspection` on the auth server
1515
// 🐨 make a POST request to the auth server with the token in the body
1616
// 💰 just gonna give this to you since it's not critical to your understanding of the topic to write yourself...
1717
// 💰 const resp = await fetch(validateUrl, {

exercises/03.auth-info/01.solution.introspect/src/auth.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ export async function getAuthInfo(request: Request): Promise<AuthInfo | null> {
1414
const token = request.headers.get('authorization')?.replace(/^Bearer\s+/i, '')
1515
if (!token) return null
1616

17-
const validateUrl = new URL('/introspect', EPIC_ME_AUTH_SERVER_URL).toString()
17+
const validateUrl = new URL(
18+
'/oauth/introspection',
19+
EPIC_ME_AUTH_SERVER_URL,
20+
).toString()
1821
const resp = await fetch(validateUrl, {
1922
method: 'POST',
2023
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },

exercises/03.auth-info/02.problem.error/src/auth.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ export async function getAuthInfo(request: Request): Promise<AuthInfo | null> {
1414
const token = request.headers.get('authorization')?.replace(/^Bearer\s+/i, '')
1515
if (!token) return null
1616

17-
const validateUrl = new URL('/introspect', EPIC_ME_AUTH_SERVER_URL).toString()
17+
const validateUrl = new URL(
18+
'/oauth/introspection',
19+
EPIC_ME_AUTH_SERVER_URL,
20+
).toString()
1821
const resp = await fetch(validateUrl, {
1922
method: 'POST',
2023
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },

exercises/03.auth-info/02.solution.error/src/auth.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ export async function getAuthInfo(request: Request): Promise<AuthInfo | null> {
1414
const token = request.headers.get('authorization')?.replace(/^Bearer\s+/i, '')
1515
if (!token) return null
1616

17-
const validateUrl = new URL('/introspect', EPIC_ME_AUTH_SERVER_URL).toString()
17+
const validateUrl = new URL(
18+
'/oauth/introspection',
19+
EPIC_ME_AUTH_SERVER_URL,
20+
).toString()
1821
const resp = await fetch(validateUrl, {
1922
method: 'POST',
2023
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },

exercises/03.auth-info/03.problem.active/src/auth.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ export async function getAuthInfo(request: Request): Promise<AuthInfo | null> {
1616
const token = request.headers.get('authorization')?.replace(/^Bearer\s+/i, '')
1717
if (!token) return null
1818

19-
const validateUrl = new URL('/introspect', EPIC_ME_AUTH_SERVER_URL).toString()
19+
const validateUrl = new URL(
20+
'/oauth/introspection',
21+
EPIC_ME_AUTH_SERVER_URL,
22+
).toString()
2023
const resp = await fetch(validateUrl, {
2124
method: 'POST',
2225
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },

exercises/03.auth-info/03.solution.active/src/auth.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ export async function getAuthInfo(request: Request): Promise<AuthInfo | null> {
2020
const token = request.headers.get('authorization')?.replace(/^Bearer\s+/i, '')
2121
if (!token) return null
2222

23-
const validateUrl = new URL('/introspect', EPIC_ME_AUTH_SERVER_URL).toString()
23+
const validateUrl = new URL(
24+
'/oauth/introspection',
25+
EPIC_ME_AUTH_SERVER_URL,
26+
).toString()
2427
const resp = await fetch(validateUrl, {
2528
method: 'POST',
2629
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },

exercises/04.user/01.problem.token/src/auth.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ export async function getAuthInfo(request: Request): Promise<AuthInfo | null> {
2020
const token = request.headers.get('authorization')?.replace(/^Bearer\s+/i, '')
2121
if (!token) return null
2222

23-
const validateUrl = new URL('/introspect', EPIC_ME_AUTH_SERVER_URL).toString()
23+
const validateUrl = new URL(
24+
'/oauth/introspection',
25+
EPIC_ME_AUTH_SERVER_URL,
26+
).toString()
2427
const resp = await fetch(validateUrl, {
2528
method: 'POST',
2629
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },

exercises/04.user/01.solution.token/src/auth.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ export async function getAuthInfo(request: Request): Promise<AuthInfo | null> {
2020
const token = request.headers.get('authorization')?.replace(/^Bearer\s+/i, '')
2121
if (!token) return null
2222

23-
const validateUrl = new URL('/introspect', EPIC_ME_AUTH_SERVER_URL).toString()
23+
const validateUrl = new URL(
24+
'/oauth/introspection',
25+
EPIC_ME_AUTH_SERVER_URL,
26+
).toString()
2427
const resp = await fetch(validateUrl, {
2528
method: 'POST',
2629
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },

0 commit comments

Comments
 (0)