fix: Move request helper function (#2594)
* Move request method to passport utils * Use request method in OIDC provider
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
// @flow
|
||||
import { addMinutes, subMinutes } from "date-fns";
|
||||
import fetch from "fetch-with-proxy";
|
||||
import { type Request } from "koa";
|
||||
import { OAuthStateMismatchError } from "../errors";
|
||||
import { getCookieDomain } from "./domains";
|
||||
@@ -47,3 +48,15 @@ export class StateStore {
|
||||
callback(null, true);
|
||||
};
|
||||
}
|
||||
|
||||
export async function request(endpoint: string, accessToken: string) {
|
||||
const response = await fetch(endpoint, {
|
||||
method: "GET",
|
||||
credentials: "same-origin",
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
});
|
||||
return response.json();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user