MCPcopy
hub / github.com/remotely-save/remotely-save / sendAuthReq

Function sendAuthReq

pro/src/account.ts:46–74  ·  view source on GitHub ↗
(
  verifier: string,
  authCode: string,
  errorCallBack: any
)

Source from the content-addressed store, hash-verified

44};
45
46export const sendAuthReq = async (
47 verifier: string,
48 authCode: string,
49 errorCallBack: any
50) => {
51 const appKey = PRO_CLIENT_ID ?? "cli-"; // hard-code
52 try {
53 const k = {
54 code: authCode,
55 grant_type: "authorization_code",
56 code_verifier: verifier,
57 client_id: appKey,
58 // redirect_uri: `obsidian://${COMMAND_CALLBACK_PRO}`,
59 scope: "pro.list.read",
60 };
61 // console.debug(k);
62 const resp1 = await fetch(`${site}/api/v1/oauth2/token`, {
63 method: "POST",
64 body: new URLSearchParams(k),
65 });
66 const resp2 = await resp1.json();
67 return resp2;
68 } catch (e) {
69 console.error(e);
70 if (errorCallBack !== undefined) {
71 await errorCallBack(e);
72 }
73 }
74};
75
76export const sendRefreshTokenReq = async (refreshToken: string) => {
77 const appKey = PRO_CLIENT_ID ?? "cli-"; // hard-code

Callers 1

onOpenMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected