MCPcopy
hub / github.com/CapSoftware/Cap / redirectWithAuthKey

Function redirectWithAuthKey

packages/web-backend/src/Extension/Http.ts:168–190  ·  view source on GitHub ↗
({
	redirectUri,
	authApiKey,
	userId,
	state,
}: {
	redirectUri: URL;
	authApiKey: string;
	userId: User.UserId;
	state: Option.Option<string>;
})

Source from the content-addressed store, hash-verified

166};
167
168const redirectWithAuthKey = ({
169 redirectUri,
170 authApiKey,
171 userId,
172 state,
173}: {
174 redirectUri: URL;
175 authApiKey: string;
176 userId: User.UserId;
177 state: Option.Option<string>;
178}) => {
179 const params = new URLSearchParams({
180 authApiKey,
181 userId,
182 });
183
184 if (Option.isSome(state)) {
185 params.set("state", state.value);
186 }
187
188 redirectUri.hash = params.toString();
189 return HttpServerResponse.redirect(redirectUri);
190};
191
192const getBearerAuthKey = Effect.gen(function* () {
193 const headers = yield* HttpServerRequest.schemaHeaders(

Callers 1

Http.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected