Skip to content

Commit

Permalink
chore: update body for github login
Browse files Browse the repository at this point in the history
Signed-off-by: shivamsouravjha <[email protected]>
  • Loading branch information
shivamsouravjha committed Oct 29, 2024
1 parent 28fd7a3 commit 0911ce6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/SignIn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export default async function SignInWithGitHub() {
// vscode.env.openExternal(vscode.Uri.parse(backendUrl));
try {
// Await the response from the backend
const response = await loginAPI(backendUrl, 'github', code?.toString(),"vscode");
const response = await loginAPI(backendUrl, 'github', code?.toString());

if (response.error) {
res.writeHead(400, { 'Content-Type': 'application/json' });
Expand Down Expand Up @@ -167,7 +167,7 @@ export async function SignInWithOthers() {
// return data;
// }

export async function loginAPI(url = "", provider = "", code = "",platform = "") {
export async function loginAPI(url = "", provider = "", code = "") {
// Default options are marked with *
// var response : Response
try {
Expand All @@ -182,7 +182,7 @@ export async function loginAPI(url = "", provider = "", code = "",platform = "")
},
redirect: "follow", // manual, *follow, error
referrerPolicy: "no-referrer", // no-referrer, *no-referrer-when-downgrade, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin, unsafe-url
body: JSON.stringify({ provider: provider, code: code,platform:platform }) // body data type must match "Content-Type" header
body: JSON.stringify({ provider: provider, code: code }) // body data type must match "Content-Type" header
});

if (response.status === 200) {
Expand Down Expand Up @@ -311,6 +311,7 @@ function extractID(output: any) {
interface AuthReq {
GitHubToken: string;
InstallationID: string;
platform: string;
}

interface AuthResp {
Expand All @@ -328,6 +329,7 @@ export async function validateFirst(token: string, serverURL: string): Promise<{
// extract string from promise
const requestBody: AuthReq = {
GitHubToken: token,
platform: "vscode",
InstallationID: installationID,
};
console.log("Request Body:", requestBody);
Expand Down

0 comments on commit 0911ce6

Please sign in to comment.