auth0 / auth0-spa-js

Auth0 authentication for Single Page Applications (SPA) with PKCE
MIT License
904 stars 358 forks source link

loginWithRedirect doesn't consider scope #268

Closed sergew92 closed 4 years ago

sergew92 commented 4 years ago

Hi everyone, I've updated my project to Auth0-spa-js, great work guys ! It's simpler indeed !

Just one thing, I'm facing an issue on the "scope" option, passed to loginWithRedirect. My goal is to pass the "w_member_social" scope on LinkedIn login (so as to allow content sharing). I'm using the New Universal Login page.

Following this advice(https://community.auth0.com/t/new-universal-login-add-connectionscopes-field/26984/4), I've modfied my code like this:


  login(redirectPath: string = '/') {
    // A desired redirect path can be passed to login method
    // (e.g., from a route guard)
    // Ensure Auth0 client instance exists
    this.auth0Client$.subscribe((client: Auth0Client) => {
      // Call method to log in
      client.loginWithRedirect({
        scope: 'w_member_social ',
        redirect_uri: `${window.location.origin}`,
        appState: { target: redirectPath },
      });
    });
  }

Unfortunately, nothing happens, the linkedIn connection page doesn't ask for permission about sharing.

It would be so nice if I could find a solution to this !

Thanks a lot for your help.

stevehobbsdev commented 4 years ago

Hi @sergew92, apologies for the wait. Let me look into this and get back to you.

stevehobbsdev commented 4 years ago

Hey @sergew92, instead of specifying the LinkedIn scope in the scope parameter, can you try using the connection_scope option? See Add scopes/permissions to call Identity Provider's APIs

sergew92 commented 4 years ago

You're right @stevehobbsdev !!! thank you so much !!