B
B
Boogie19892016-08-09 11:22:36
Google
Boogie1989, 2016-08-09 11:22:36

Google authorization with satellizer?

I'm trying to authorize through Google using satellitelizer. My config

$authProvider.google({
            clientId: '123.apps.googleusercontent.com',
            url: '/api/auth/google/login',
            authorizationEndpoint: 'https://accounts.google.com/o/oauth2/auth',
            redirectUri: window.location.origin,
            requiredUrlParams: ['scope'],
            optionalUrlParams: ['display'],
            scope: ['profile', 'email'],
            scopePrefix: 'openid',
            scopeDelimiter: ' ',
            display: 'popup',
            oauthType: '2.0',
            // responseType: 'token',
            popupOptions: {
                width: 452,
                height: 633
            }
        });

If everything is left in this form, then the modal window closes successfully, but the /api/auth/google/login request throws an error
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ' localhost:3000 ' is therefore not allowed access. The response had HTTP status code 404.
But if you change redirectUri to /api/auth/google/login , the response is displayed in a modal window and doesn't close. How to fix it all? If important, then backing to Yii.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
_
_ _, 2016-08-10
@AMar4enko

This is a common problem with CORS policies and there have been a lot of questions about it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question