auth0 / lock-passwordless

Auth0 Lock Passwordless [DEPRECATED]
MIT License
90 stars 29 forks source link

passwordless lock not sending all scopes provided in options #117

Closed mahdiraddadi closed 7 years ago

mahdiraddadi commented 7 years ago

I am trying to add app_metadata and user_metadata to scopes to get a token with user information, but I am reciving a token with openid informations only and when I try to see the scopes sent to the API https://mydomain.auth0.com/oauth/ro in parameters, I am seeing only the "openid". I am using the PasswordLessLock version v2.2.3. how can I solve this issues?

    var options = {
              auth: {
                    responseType: 'token',
                    params: {scope: 'openid email user_metadata app_metadata picture'},
                  },
              autoclose: true,
            };

        var lock = new Auth0LockPasswordless('key', 'domain', {                         
            closable: false,
            auth: {
                responseType: 'token',
                params: {
                  scope: 'openid app_metadata user_metadata username email'
                }
              }
        });

        // Open the lock in Email Code mode with the ability to handle
        // the authentication in page
        lock.emailcode(options, function (err, profile, id_token, state) {
          if (!err) {
            // Save the JWT token.
              store.set('token', id_token);          
          }
        });
jensdotbruggeman commented 7 years ago

I am having the same issue. It seems like Auth0LockPasswordless does not support the scopes setting? I only need username from the profile :-)

Is there a nice way to send them correctly from the Angular2 app to the server? On the server-side, I succeeded in retrieving the userprofile by POST to /tokeninfo .. but this is not an elegant solution.

mahdiraddadi commented 7 years ago

@jensdotbruggeman I found the solution, I think I did a wrong parameters in the json of the lock options and it's working fine for me, may my code will help you :

var lock = new Auth0LockPasswordless("AUTH0_CLIENT_ID", "AUTH0_DOMAIN");
        lock.emailcode({
            autoclose: true,
            popup: true,
            dict: {title: ""},
            icon: "LOGO_URL",
            primaryColor : 'rgb(3, 155, 229)',
                authParams: {
                      scope: 'openid roles user_id email name'  
               }
          },function (err, profile, id_token) {
              if (!err) {
                    // Save the JWT token.
                      store.set('token', id_token);
                    onLoginCustomerSuccess(profile,id_token);

                  }}
              );