File tree Expand file tree Collapse file tree 16 files changed +55
-16
lines changed
01.problem.introspect/src
01.solution.introspect/src
01.problem.validate-scopes/src
01.solution.validate-scopes/src
02.problem.specify-scopes/src
02.solution.specify-scopes/src Expand file tree Collapse file tree 16 files changed +55
-16
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 11import { invariantResponse } from '@epic-web/invariant'
22import { type Token } from '#types/helpers'
3- import { type Route } from './+types/introspect '
3+ import { type Route } from './+types/introspection.ts '
44
55export async function action ( { request, context } : Route . LoaderArgs ) {
66 const token = ( await request . formData ( ) ) . get ( 'token' ) ?. toString ( )
Original file line number Diff line number Diff 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, {
Original file line number Diff line number Diff line change @@ -14,7 +14,10 @@ export async function getAuthInfo(request: Request): Promise<AuthInfo | null> {
1414 const token = request . headers . get ( 'authorization' ) ?. replace ( / ^ B e a r e r \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' } ,
Original file line number Diff line number Diff line change @@ -14,7 +14,10 @@ export async function getAuthInfo(request: Request): Promise<AuthInfo | null> {
1414 const token = request . headers . get ( 'authorization' ) ?. replace ( / ^ B e a r e r \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' } ,
Original file line number Diff line number Diff line change @@ -14,7 +14,10 @@ export async function getAuthInfo(request: Request): Promise<AuthInfo | null> {
1414 const token = request . headers . get ( 'authorization' ) ?. replace ( / ^ B e a r e r \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' } ,
Original file line number Diff line number Diff line change @@ -16,7 +16,10 @@ export async function getAuthInfo(request: Request): Promise<AuthInfo | null> {
1616 const token = request . headers . get ( 'authorization' ) ?. replace ( / ^ B e a r e r \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' } ,
Original file line number Diff line number Diff line change @@ -20,7 +20,10 @@ export async function getAuthInfo(request: Request): Promise<AuthInfo | null> {
2020 const token = request . headers . get ( 'authorization' ) ?. replace ( / ^ B e a r e r \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' } ,
Original file line number Diff line number Diff line change @@ -20,7 +20,10 @@ export async function getAuthInfo(request: Request): Promise<AuthInfo | null> {
2020 const token = request . headers . get ( 'authorization' ) ?. replace ( / ^ B e a r e r \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' } ,
Original file line number Diff line number Diff line change @@ -20,7 +20,10 @@ export async function getAuthInfo(request: Request): Promise<AuthInfo | null> {
2020 const token = request . headers . get ( 'authorization' ) ?. replace ( / ^ B e a r e r \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' } ,
You can’t perform that action at this time.
0 commit comments