@@ -4,8 +4,8 @@ import { exchangeCodeForAccessToken, getUpstreamAuthorizeUrl } from "../lib/oaut
4
4
import type { Props } from "../types" ;
5
5
import { SentryApiService } from "../lib/sentry-api" ;
6
6
7
- export const SENTRY_AUTH_URL = "https://sentry.io /oauth/authorize/" ;
8
- export const SENTRY_TOKEN_URL = "https://sentry.io /oauth/token/" ;
7
+ export const SENTRY_AUTH_URL = "/oauth/authorize/" ;
8
+ export const SENTRY_TOKEN_URL = "/oauth/token/" ;
9
9
// https://docs.sentry.io/api/permissions/
10
10
export const SCOPES = "org:read project:read project:write team:read team:write event:read" ;
11
11
@@ -14,6 +14,7 @@ export default new Hono<{
14
14
OAUTH_PROVIDER : OAuthHelpers ;
15
15
SENTRY_CLIENT_ID : string ;
16
16
SENTRY_CLIENT_SECRET : string ;
17
+ SENTRY_URL : string ;
17
18
} ;
18
19
} > ( )
19
20
/**
@@ -34,7 +35,7 @@ export default new Hono<{
34
35
35
36
return Response . redirect (
36
37
getUpstreamAuthorizeUrl ( {
37
- upstream_url : SENTRY_AUTH_URL ,
38
+ upstream_url : new URL ( SENTRY_AUTH_URL , c . env . SENTRY_URL || "https://sentry.io" ) . href ,
38
39
scope : SCOPES ,
39
40
client_id : c . env . SENTRY_CLIENT_ID ,
40
41
redirect_uri : new URL ( "/callback" , c . req . url ) . href ,
@@ -60,7 +61,7 @@ export default new Hono<{
60
61
61
62
// Exchange the code for an access token
62
63
const [ payload , errResponse ] = await exchangeCodeForAccessToken ( {
63
- upstream_url : SENTRY_TOKEN_URL ,
64
+ upstream_url : new URL ( SENTRY_TOKEN_URL , c . env . SENTRY_URL || "https://sentry.io" ) . href ,
64
65
client_id : c . env . SENTRY_CLIENT_ID ,
65
66
client_secret : c . env . SENTRY_CLIENT_SECRET ,
66
67
code : c . req . query ( "code" ) ,
0 commit comments