Skip to content

Commit

Permalink
feat: Platform VSCODE flag
Browse files Browse the repository at this point in the history
Signed-off-by: Yash Khare <[email protected]>
  • Loading branch information
khareyash05 committed Oct 28, 2024
1 parent 05e1eea commit 914edfe
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/SignIn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { v4 as uuidv4 } from 'uuid';
const os = require('os');
const { execSync } = require('child_process');
import axios, { AxiosResponse } from 'axios';
import { platform } from 'os';


async function fetchGitHubEmail(accessToken: string): Promise<string | null> {
Expand Down Expand Up @@ -118,7 +119,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());
const response = await loginAPI(backendUrl, 'github', code?.toString(),"vscode");

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

export async function loginAPI(url = "", provider = "", code = "") {
export async function loginAPI(url = "", provider = "", code = "",platform = "") {
// Default options are marked with *
// var response : Response
try {
Expand All @@ -182,7 +183,7 @@ export async function loginAPI(url = "", provider = "", code = "") {
},
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 }) // body data type must match "Content-Type" header
body: JSON.stringify({ provider: provider, code: code,platform:platform }) // body data type must match "Content-Type" header
});

if (response.status === 200) {
Expand Down

0 comments on commit 914edfe

Please sign in to comment.