How to use the hellojs.login function in hellojs

To help you get started, we’ve selected a few hellojs examples, based on popular ways it is used in public projects.

github marmelab / ZeroDollarHomePage / src / frontend / js / user / userApi.js View on Github external
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,
                    },
                });
            });
        }, err => resolve({ error: err.error }));
});

hellojs

A clientside Javascript library for standardizing requests to OAuth2 web services (and OAuth1 - with a shim)

MIT
Latest version published 1 year ago

Package Health Score

62 / 100
Full package analysis