angularx-social-login icon indicating copy to clipboard operation
angularx-social-login copied to clipboard

How to trigger social login in current tab instead of new window?

Open azurehari opened this issue 6 years ago • 24 comments

When i call the social login using angularx-social-login it will pop in new window.. i want to open it in current tab. could you please help me out?

azurehari avatar Feb 11 '20 12:02 azurehari

Also looking for this. Can anyone please point us in the right direction? thanks in advance.

Fanksies avatar Feb 19 '20 20:02 Fanksies

Following! This is also interesting from my point of view!

RMarjanovic avatar Apr 11 '20 08:04 RMarjanovic

Does any one of you guys experiencing the fb dialog is block when you open the link of your app in fb browser?

gitalvininfo avatar Apr 15 '20 14:04 gitalvininfo

Please check how Facebook suggests handling it. This library just delegates the login functionality to Facebook's authentication JS library.

jaibatrik avatar Apr 25 '20 08:04 jaibatrik

Hi all.

Had this bug for a few days now. Here's what basically happens during the entire login process:

When FB Mobile Browser is used, the browser already acknowledges that the user has logged in. When FB.login is called, nothing happens. What needs to be done is the use the current accessToken and loggedIn userID to fetch the user's details and then pass it on wherever necessary.

    FB.getLoginStatus((response: any) => {
      if (response.status !== 'connected') {
        return FB.login((response: any) => {
          this.handleResponse(response)
        }, {
          scope: 'public_profile,email',
          enable_profile_selector: true,
          auth_type: 'rerequest',
          return_scopes: true
        });
      } else {
        this.handleResponse(response)
      }
    });
  }

  handleResponse(response) {
    FB.api(`/me?fields=email,picture,first_name,last_name`,
      (response: any) => {
        this.tellServerToLogin()
      })
  }`

seaver-choy avatar Jun 11 '20 11:06 seaver-choy

I am also facing the same issue with google login . On googling found a solution to add an option while calling socialAuthService.signIn(GoogleLoginProvider.PROVIDER_ID,options) method where options ={ux_mode: "redirect"} . Before performing login operation , we will have to provide redirect uri in google developer console as our current page (ex : http://localhost:4200 ) . I tried login after adding options. But not getting any response . What should i do ?

arun-s-aot avatar Jun 25 '20 18:06 arun-s-aot

Sharing a comment from another related issue; please check if the following helps - https://github.com/abacritt/angularx-social-login/issues/263#issuecomment-652258506

jaibatrik avatar Jul 02 '20 06:07 jaibatrik

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 31 '20 06:08 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 30 '20 20:10 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jan 06 '21 10:01 stale[bot]

This issue is really important. With this work around the social login only works when it use with facebook social login not nothing else. When a user navigates to the application through a facebook ad in mobile, it cannot be logged in through google. Is there any solution today for the google login when the application is opened from facebook on mobile? Thanks!!!

horuko avatar Feb 05 '21 06:02 horuko

Hi. Ive experienced issue the same as yours, I open my web app in facebook app and the facebook login doesn't work. What fix my issue is that Ive given a setTimeout for about 2 seconds before initializing the facebook and that works for me. I dont know if that fix your issue just sharing what Ive encountered which same as yours.

What is currently the behaviour when you press on login with google through fb mobile app? Does the google login window closes?

On Fri, 5 Feb 2021, 2:40 pm Andrés, [email protected] wrote:

This issue is really important. With this work around the social login only works when it use with facebook social login not nothing else. When a user navigates to the application through a facebook ad in mobile, it cannot be logged in through google. Is there any solution today for the google login when the application is opened from facebook on mobile? Thanks!!!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/abacritt/angularx-social-login/issues/248#issuecomment-773828161, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADNAKEHWK5WJGTZFK44OBADS5OHEHANCNFSM4KS767WA .

gitalvininfo avatar Feb 05 '21 11:02 gitalvininfo

Ok, I got it.

The behavior is similar. When the user returns to the application once they have logged in with google, the authstate returns the user who has logged in.

It's just a matter of improving the experience.

The only thing I have had to do is set the redirect settings for google authentication new GoogleLoginProvider (environment.google.loginProvider, {scope: 'email', ux_mode: 'redirect'}) and add the authstate check in the component's ngOnInit to see if the user is logged in to google or not. Please, ignore my comment, I did not know that properties could be passed directly to google library from the provider 😅

Thanks, good job!

horuko avatar Feb 05 '21 15:02 horuko

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 15 '21 22:05 stale[bot]

For google provider, we can use

new GoogleLoginProvider (environment.google.loginProvider, {scope: 'email', ux_mode: 'redirect'})

How about Facebook provider? do we have any way to login with redirect mode instead of popup?

mbvb1223 avatar Jun 19 '21 16:06 mbvb1223

hi @jaibatrik

Thanks for the great plugin. Any progress on this one? Cheers!

guy-keller avatar Nov 11 '21 10:11 guy-keller

hi all, do you have any suggestion on this issue?

It is a big impact thing because many users login from facebook application.

mbvb1223 avatar Dec 20 '21 10:12 mbvb1223

how did anyone fix this on mobile browsers ? I have this issue with certain browsers only, but it still is important. Currently I have removed the package for Facebook by manually doing it on my own backend. Considering discontinuing this package if this persists as it doesn't support mobile browser environment or doesn't guide on how to fix this issue.

Leslie717 avatar Apr 03 '22 12:04 Leslie717

For google provider, we can use

new GoogleLoginProvider (environment.google.loginProvider, {scope: 'email', ux_mode: 'redirect'})

How about Facebook provider? do we have any way to login with redirect mode instead of popup?

I'm using version 1.2.5. in this version ux_mode does not exist in GoogleInitOptions "@abacritt/angularx-social-login": "^1.2.5",

export interface GoogleInitOptions {
   oneTapEnabled?: boolean;
   scopes?: string | string[];
   prompt_parent_id?: string;
   prompt?: '' | 'none' | 'consent' | 'select_account';
}

Where should I set ux_mode to redirect?

aroshanzamir avatar Oct 13 '22 22:10 aroshanzamir

I'd second that, where's the ux_mode to redirect? This is important to have and it's not there anymore.

balazspekar avatar Jan 04 '23 14:01 balazspekar

+1. Any progress on the ux_mode property ?

EdvinM avatar Mar 20 '23 11:03 EdvinM

+1. really need the redirect method.

Currently, our users have to enable the popup on their browser to see the login screen. I don't want that.

tsenguunchik avatar Jun 12 '23 21:06 tsenguunchik