Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
hizclick committed Sep 28, 2023
1 parent 47104ca commit 7108525
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,23 @@ export default createStore({
commit('TOGGLE_LOADGIT_MODAL')
},
authenticate ({commit, state}, {code}){

console.log("this is the authenticate function ")
const clientId = CLIENT_ID;
const redirectUri = CALL_BACK;
const clientSecret = CLIENT_SECRET;
const scope = 'user';


const query = qs.stringify({
client_id: clientId,
client_secret: clientSecret,
redirect_uri: redirectUri,
scope,
});

const url = `auth?code=${code}`
const url = `https://github.com/login/oauth/authorize?auth?code=${code}&${query}`
console.log(url)

fetch(url).then(resp => {
if (resp.ok) {
Expand All @@ -428,11 +443,11 @@ export default createStore({


} else {
console.error('authentication failed', data)
console.error('authentication failed 1', data)
}
})
} else {
console.error('authentication failed', resp.statusText)
console.error('authentication failed 2', resp.statusText)
}
})

Expand Down Expand Up @@ -493,12 +508,8 @@ export default createStore({
// }

const clientId = CLIENT_ID;
<<<<<<< HEAD
const redirectUri = CALL_BACK;
const clientSecret = CLIENT_SECRET;
=======
const redirectUri = 'https://cartographer-app.zenmem.de/callback';
>>>>>>> 03bc754534ee4a7789844d1eeaa6d7f095d65f0d
const scope = 'user';


Expand All @@ -508,8 +519,8 @@ export default createStore({
redirect_uri: redirectUri,
scope,
});
console.log("this is the client id " + clientId)
window.location.href = `https://github.com/login/oauth/authorize?${query}`;
state.logedin = true
window.location.href = `https://github.com/login/oauth/authorize?${query}`;
},

// Call the callback function
Expand Down

0 comments on commit 7108525

Please sign in to comment.