diadal / universal-social-auth

SPA universal social auth
MIT License
40 stars 11 forks source link

Response code never returned #10

Open zlayine opened 2 years ago

zlayine commented 2 years ago

Bug When I try to use the social auth with google, it opens a popup but it redirects to the redirect URI in the popup but never closes the popup or returns the response from where I'm trying to log in

awsomplak commented 2 years ago

Bug When I try to use the social auth with google, it opens a popup but it redirects to the redirect URI in the popup but never closes the popup or returns the response from where I'm trying to log in

Same Here

diadal commented 2 years ago

create the vue route

 {
          path: '/auth/:provider/callback',
          component: {
            template: '<div class="auth-component"></div>'
          }
        },
bplainia commented 1 year ago

@diadal Could you put that you must redirect back to the same domain as the UI in the README? Along with your suggestion above, this worked.

awsomplak commented 1 year ago

create the vue route

 {
          path: '/auth/:provider/callback',
          component: {
            template: '<div class="auth-component"></div>'
          }
        },

Solved with this Make laravel socialite redirect to vue path

lexinzector commented 1 year ago

Solved with this Make laravel socialite redirect to vue path

but it didn't help me

lexinzector commented 1 year ago

I'm trying to login with facebook.

return redirect('/auth/facebook/callback', 301);

i added this code to Controller. the redirect occurs, but the authorization dialog does not close and when the dialog is forced to close, an error occurs in the console response Error: Auth popup window closed at index.js:1:10661

debugging output I did via console.log in this vue function

<button @click="useAuthProvider('facebook')">check</button>
useAuthProvider(provider){
    let type = null;
    switch(provider){
        case 'facebook':
            type = Facebook;
            break;
    }
    this.$Oauth.authenticate(provider, type).then((response) => {
        console.log('response', response);
        if(response.code){
            console.log('xxx');
        }
    }).catch((err) => {
        console.log(err);
    })
},
lexinzector commented 1 year ago

i added console.log code to index.js in this component and got a new error when i try to close the dialog DOMException: Blocked a frame with origin "https://my-site-url" from accessing a cross-origin frame.

diadal commented 1 year ago

you need to add/whitelit the allowed URL in your facebook app

lexinzector commented 1 year ago

i added all possible url options in my facebook app but it didn't help. what am I doing wrong?

Screenshot_15

Screenshot_16

lexinzector commented 1 year ago

my problem is solved. my server architecture uses a load balancer. on the main server, the site works via http and on the balancer via https. the backend runs on lumen and accesses social networks via the http protocol. The problem was solved by setting a trusted proxy for lumen. also in the SocialLogin function of the controller, I disabled the redirect to /auth/:provider/callback and replaced it with returning an array of data ({u=>user}) and everything worked