Commit ed3958ab authored by Anton's avatar Anton

Do not use window in electron auth service

parent b21af278
Pipeline #17461 passed with stage
in 2 minutes and 34 seconds
......@@ -13,11 +13,11 @@ const
keytarAccount = os.userInfo().username
function getAuthenticationURL () {
return 'https://' + (window.AUTH0_DOMAIN || process.env.AUTH0_DOMAIN) + '/authorize?' +
'audience=' + (window.AUTH0_AUDIENCE || process.env.AUTH0_AUDIENCE) + '&' +
return 'https://' + (process.env.AUTH0_DOMAIN) + '/authorize?' +
'audience=' + (process.env.AUTH0_AUDIENCE) + '&' +
'scope=openid profile offline_access&' +
'response_type=code&' +
'client_id=' + (window.AUTH0_CLIENT_ID || process.env.AUTH0_CLIENT_ID) + '&' +
'client_id=' + (process.env.AUTH0_CLIENT_ID) + '&' +
'redirect_uri=' + redirectUri
}
......@@ -25,9 +25,9 @@ async function refreshTokens () {
const refreshToken = await keytar.getPassword(keytarService, keytarAccount)
if (!refreshToken) return throw new Error('No refresh token found')
const result = await axios.post(`https://${window.AUTH0_DOMAIN || process.env.AUTH0_DOMAIN}/oauth/token`, {
const result = await axios.post(`https://${process.env.AUTH0_DOMAIN}/oauth/token`, {
grant_type: 'refresh_token',
client_id: window.AUTH0_CLIENT_ID || process.env.AUTH0_CLIENT_ID,
client_id: process.env.AUTH0_CLIENT_ID,
refresh_token: refreshToken
}, {
headers: {'Content-Type': 'application/json'}
......@@ -43,12 +43,12 @@ async function loadTokens (callbackURL) {
const exchangeOptions = {
'grant_type': 'authorization_code',
'client_id': window.AUTH0_CLIENT_ID || process.env.AUTH0_CLIENT_ID,
'client_id': process.env.AUTH0_CLIENT_ID,
'code': query.code,
'redirect_uri': redirectUri
}
const result = await axios.post(`https://${window.AUTH0_DOMAIN || process.env.AUTH0_DOMAIN}/oauth/token`, exchangeOptions, {
const result = await axios.post(`https://${process.env.AUTH0_DOMAIN}/oauth/token`, exchangeOptions, {
headers: {
'Content-Type': 'application/json'
}
......@@ -66,7 +66,7 @@ async function logout () {
}
function getLogOutUrl () {
return `https://${window.AUTH0_DOMAIN || process.env.AUTH0_DOMAIN}/v2/logout`
return `https://${process.env.AUTH0_DOMAIN}/v2/logout`
}
export {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment