Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
document.addEventListener('DOMContentLoaded', () => {
// Init sign-in library.
hello.init({
github: process.env.GITHUB_CLIENT_PUBLIC_ID,
}, {
redirect_uri: '/redirect.html',
});
const loggerMiddleware = createLogger();
const store = createStore(
connectRouter(history)(rootReducer),
{},
compose(
applyMiddleware(
routerMiddleware(history),
thunkMiddleware,
loggerMiddleware,
),
return true
},
form: false
}
});
// Configure application details
hello.init({ azureAD: backendClientID }, {
redirect_uri: redirectUrl,
scope: `openid https://${tenantName}.onmicrosoft.com/${backendClientApiID}/${backendClientScopeName}`,
response_type: 'token id_token',
resource: `${backendClientApiID}`,
display: 'page',
});
hello.on('auth.login', (auth) => {
this.handleAuthLogin(auth);
});
}
signOut(uploadStatus) {
let signout = true;
if (uploadStatus === 'uploading') {
signout = confirm('You are currently uploading files. Signing out of this site will cancel the upload process. Are you sure you want to sign out?');
}
if (signout) {
hello('google').logout().then(() => {
upload.setInitialState();
this.clearAuth();
router.transitionTo('signIn');
}, () => {
// signout failure
});
}
},
import * as hellojs from 'hellojs';
import {HEADER_HEIGHT} from '../shared/constants';
import {playCameraSound} from '../shared/audio';
import AnnotatePage from './annotate';
import SharePage from './share';
import {PAGES} from '../shared/constants';
import {showPage, showPrompt} from '../shared/helpers';
const hello = hellojs.default;
const PAGE_NAME = PAGES.SNAPSHOT;
let backBtn = document.getElementById('btn-back-snapshot');
let tweetButton = document.getElementById('btn-share-twitter');
let drawingCanvas = document.getElementById('canvas-draw');
let saveCanvas = document.getElementById('canvas-save');
let saveImage = document.getElementById('image-save');
let saveCtx = saveCanvas.getContext('2d');
let cameraCanvas;
function initSave() {
// May have been swapped out after initial app load
cameraCanvas = document.getElementById('canvas-camera');
saveCanvas.width = cameraCanvas.width;
async oauthLogin (ev) {
ev.preventDefault();
const id = ev.target.getAttribute('data-id');
this.provider = _converse.oauth_providers.get(id);
this.oauth_service = hello(id);
const data = {};
data[id] = this.provider.get('client_id');
hello.init(data, {
'redirect_uri': '/redirect.html'
});
await this.oauth_service.login();
this.fetchOAuthProfileDataAndLogin();
}
});
return (dispatch) => {
hello('github').logout()
.then(() => {
dispatch(receiveSignedOut());
}, console.log.bind(console));
};
}
initHello () {
const credentials = {
facebook: process.env.HELLO_FACEBOOK,
google: process.env.HELLO_GOOGLE,
github: process.env.HELLO_GITHUB
}
const options = {
scope: 'email',
redirect_uri: process.env.HELLO_REDIRECT_URI
}
hello.init(credentials, options)
this.hello = hello.bind(hello)
}
}
import hello from 'hellojs';
const credentials = {};
const options = {};
credentials.facebook = APP_CONFIG.FACEBOOK_ID;
credentials.google = APP_CONFIG.GOOGLE_ID;
credentials.github = APP_CONFIG.GITHUB_ID;
options.redirect_uri = `${location.protocol}//${location.host}`;
options.scope = 'email';
hello.init(credentials, options);
export default hello;
export const signInWithGithub = () => new Promise((resolve) => {
hellojs.init({
github: GITHUB_CLIENT_ID,
}, {
oauth_proxy: `${API_URL}/oauthproxy`,
});
hellojs
.login('github')
.then(auth => {
hellojs(auth.network).api('/me').then(user => {
resolve({
user: {
access_token: auth.authResponse.access_token,
...user,
},
});
});
initOAuth() {
hello.init({google: config.auth.google.clientID}, {redirect_uri: '/'});
this.checkUser();
},