Skip to content

Commit 4313799

Browse files
Update private network preflight (#357)
During initial testing, the original fix was working, but in subsequent testing, these additional headers were required to allow Chrome to redirect to the loopback server successfully.
1 parent 0e83a81 commit 4313799

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Sources/AppAuth/macOS/OKTRedirectHTTPHandler.m

+8-1
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,13 @@ - (void)HTTPConnection:(HTTPConnection *)conn didReceiveRequest:(HTTPServerReque
141141
200,
142142
NULL,
143143
kCFHTTPVersion1_1);
144+
CFStringRef origin = CFHTTPMessageCopyHeaderFieldValue(mess.request, (__bridge CFStringRef)@"Origin");
145+
CFHTTPMessageSetHeaderFieldValue(response,
146+
(__bridge CFStringRef)@"Access-Control-Allow-Origin",
147+
origin);
148+
CFHTTPMessageSetHeaderFieldValue(response,
149+
(__bridge CFStringRef)@"Access-Control-Allow-Credentials",
150+
(__bridge CFStringRef)@"true");
144151
CFHTTPMessageSetHeaderFieldValue(response,
145152
(__bridge CFStringRef)@"Access-Control-Allow-Private-Network",
146153
(__bridge CFStringRef)@"true");
@@ -149,7 +156,7 @@ - (void)HTTPConnection:(HTTPConnection *)conn didReceiveRequest:(HTTPServerReque
149156
(__bridge CFStringRef)@"0");
150157
[mess setResponse:response];
151158
CFRelease(response);
152-
return;
159+
return;
153160
}
154161

155162
// Sends URL to AppAuth.

0 commit comments

Comments
 (0)