Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

login after signup does not show the configured widget #11

Open
rakesh-agrawal opened this issue Mar 5, 2018 · 29 comments
Open

login after signup does not show the configured widget #11

rakesh-agrawal opened this issue Mar 5, 2018 · 29 comments

Comments

@rakesh-agrawal
Copy link

Hi,

We are using the package and having below configuration:

this.signupWithAuth0 = function() {
auth0 = initLock({
closable: true,
autoclose: true,
loginAfterSignUp: true
});
auth0.show();
};

this.loginWithAuth0 = function() {
auth0 = initLock({
closable: true,
autoclose: true,
theme: {
logo: Meteor.settings.public.auth0Logo
}
});
auth0.show();
};

As per our configuration, application will try to login the user after signup.
We have also put a rule so that user can login only after email verification.

So as soon as user signs up, our application shows a lock widget to login and gives a message that email verification is pending (as per the Auth0 rule we created). In this widget we do not see our configuration like company logo etc. We see the default lock widget from Auth0.

Where can we configure this? Is this widget is different from the login widget? Ideally it should be same right??

Thanks in Advance.

@rakesh-agrawal
Copy link
Author

Any pointers?

@xcv58
Copy link
Owner

xcv58 commented Mar 9, 2018

Just confirm, are you able to see your logo in signup and login widget, but can't see it in the email verification widget?

@rakesh-agrawal
Copy link
Author

Yes...

@xcv58
Copy link
Owner

xcv58 commented Mar 9, 2018

I think it's because the package is using the default option to handle Auth0 error. Details in

export const initLock = (options = {}) => {

Could you please add logs right after your initLock statements to confirm this?

The workflow should be:

  1. User use this.signupWithAuth0 to sign up
  2. Sign up succeed, the page is reloaded with auth0 URL
  3. The package inits a default Lock object to handle auto sign in (auth0 URL from step 2), and find the user email is not verified then popup error widget (without your logo).

Could you please confirm whether my guess is correct and we can discuss solution/workaround for this?

@rakesh-agrawal
Copy link
Author

I guess you are absolutely right. In case of error, lock is displayed with default options.

@xcv58
Copy link
Owner

xcv58 commented Mar 9, 2018

Can you try to call initLock in Meteor.startup() with your config?
I know it may not work because of the race condition. But it worths a try.

The long-term solution should be not initLock in the package itself and ask the developer to init their own lock object. But it's a breaking change and may need test and warning if developer forgets to init lock.

@rakesh-agrawal
Copy link
Author

Ok, We will try to put initlock in startUp. Could you please elaborate what race conditions you are referring.

For the long term solution, I guess it will require changes in the package itself right??

Thanks for helping us!!

@xcv58
Copy link
Owner

xcv58 commented Mar 9, 2018

The race condition is that the default Lock may handle the error before the Lock you init in Meteor.startup().

Yes, the long-term solution requires some changes in the package and will break existing code for someone. But it's just my initial idea, I haven't think about it carefully.

Thank you for reporting the bug and using the package!

@rakesh-agrawal
Copy link
Author

Hi,

We have tried putting the lock init in Meteor.startUp(). It works but we are getting another issue 'STATE' DOES NOT MATCH

thanks

@xcv58
Copy link
Owner

xcv58 commented Mar 9, 2018

Could you explain more about 'STATE' DOES NOT MATCH?

@rakesh-agrawal
Copy link
Author

This is the error I see on the Auth0 Lock widget and we get this only when we put lock init in Meteor.startUp()

@xcv58
Copy link
Owner

xcv58 commented Mar 10, 2018

This should be the race condition I mentioned. I'm trying to fix it.

@rakesh-agrawal
Copy link
Author

Thanks!!
We are few days away from our beta release...This fix would help us. Thank You!!

@xcv58
Copy link
Owner

xcv58 commented Mar 10, 2018

Related to auth0/lock#907

@rakesh-agrawal
Copy link
Author

ok.. Will it take time to fix?

@xcv58
Copy link
Owner

xcv58 commented Mar 10, 2018

I publish 8.0.0 https://atmospherejs.com/xcv58/auth0-lock with breaking change:

import { Meteor } from 'meteor/meteor';
import { initLock } from 'meteor/xcv58:auth0-lock';
Meteor.startup(function () {
  // This is required to handle login
  const Lock = initLock();
  Lock.show();
})

Could you have a try?

@rakesh-agrawal
Copy link
Author

Ok, So upgrading the package should solve this issue. Will upgrade and let you know..
thanks

@xcv58
Copy link
Owner

xcv58 commented Mar 10, 2018

Thanks.

@rakesh-agrawal
Copy link
Author

rakesh-agrawal commented Mar 11, 2018

Hi,

I tried upgrading the package. But after upgrade my server is not starting.

Below is the error I am getting:
C:\Users\rakesh_agrawal\AppData\Local.meteor\packages\tap_i18n\1.8.2\plugin.tap-i18n-compiler.os\npm\node_modules\meteor\promise\node_modules\meteor-promise\promise_server.js:116
throw error;
^

TypeError: Path must be a string. Received undefined
at assertPath (path.js:28:11)
at relative (path.js:1262:5)
at ImportScanner._getRelativeImportId (C:\tools\isobuild\import-scanner.js:662:24)
at each (C:\tools\isobuild\import-scanner.js:632:33)
at .each..forEach (C:\Users\rakesh_agrawal\AppData\Local.meteor\packages\meteor-tool\1.6.1\mt-os.windows.x86_64\dev_bundle\lib\node_modules\underscore\underscore.js:87:22)
at ImportScanner._resolve (C:\tools\isobuild\import-scanner.js:621:7)
at each (C:\tools\isobuild\import-scanner.js:728:29)
at .each..forEach (C:\Users\rakesh_agrawal\AppData\Local.meteor\packages\meteor-tool\1.6.1\mt-os.windows.x86_64\dev_bundle\lib\node_modules\underscore\underscore.js:87:22)
at ImportScanner._scanFile (C:\tools\isobuild\import-scanner.js:719:5)
at each (C:\tools\isobuild\import-scanner.js:812:12)
at .each..forEach (C:\Users\rakesh_agrawal\AppData\Local.meteor\packages\meteor-tool\1.6.1\mt-os.windows.x86_64\dev_bundle\lib\node_modules\underscore\underscore.js:87:22)
at ImportScanner._scanFile (C:\tools\isobuild\import-scanner.js:719:5)
at each (C:\tools\isobuild\import-scanner.js:812:12)
at .each..forEach (C:\Users\rakesh_agrawal\AppData\Local.meteor\packages\meteor-tool\1.6.1\mt-os.windows.x86_64\dev_bundle\lib\node_modules\underscore\underscore.js:87:22)
at ImportScanner._scanFile (C:\tools\isobuild\import-scanner.js:719:5)
at each (C:\tools\isobuild\import-scanner.js:812:12)
at .each..forEach (C:\Users\rakesh_agrawal\AppData\Local.meteor\packages\meteor-tool\1.6.1\mt-os.windows.x86_64\dev_bundle\lib\node_modules\underscore\underscore.js:87:22)
at ImportScanner._scanFile (C:\tools\isobuild\import-scanner.js:719:5)
at each (C:\tools\isobuild\import-scanner.js:812:12)
at .each..forEach (C:\Users\rakesh_agrawal\AppData\Local.meteor\packages\meteor-tool\1.6.1\mt-os.windows.x86_64\dev_bundle\lib\node_modules\underscore\underscore.js:87:22)
at ImportScanner._scanFile (C:\tools\isobuild\import-scanner.js:719:5)
at each (C:\tools\isobuild\import-scanner.js:812:12)
at .each..forEach (C:\Users\rakesh_agrawal\AppData\Local.meteor\packages\meteor-tool\1.6.1\mt-os.windows.x86_64\dev_bundle\lib\node_modules\underscore\underscore.js:87:22)
at ImportScanner.scanFile (C:\tools\isobuild\import-scanner.js:719:5)
at outputFiles.forEach.file (C:\tools\isobuild\import-scanner.js:414:14)
at Array.forEach ()
at ImportScanner.scanImports (C:\tools\isobuild\import-scanner.js:412:22)
at sourceBatches.forEach.batch (C:\tools\isobuild\compiler-plugin.js:1045:17)
at Array.forEach ()
at Function.computeJsOutputFilesMap (C:\tools\isobuild\compiler-plugin.js:1013:19)
at ClientTarget.emitResources (C:\tools\isobuild\bundler.js:1057:8)
at buildmessage.enterJob (C:\tools\isobuild\bundler.js:828:12)
at C:\tools\utils\buildmessage.js:359:18
at exports.EnvironmentVariable.withValue (C:\tools\utils\fiber-helpers.js:89:14)
at C:\tools\utils\buildmessage.js:352:34
at exports.EnvironmentVariable.withValue (C:\tools\utils\fiber-helpers.js:89:14)
at C:\tools\utils\buildmessage.js:350:23
at exports.EnvironmentVariable.withValue (C:\tools\utils\fiber-helpers.js:89:14)
at Object.enterJob (C:\tools\utils\buildmessage.js:324:26)
at ClientTarget.make (C:\tools\isobuild\bundler.js:819:18)
at C:\tools\isobuild\bundler.js:2929:14
at C:\tools\isobuild\bundler.js:3018:20
at Array.forEach ()
at Function.
.each.
.forEach (C:\Users\rakesh_agrawal\AppData\Local.meteor\packages\meteor-tool\1.6.1\mt-os.windows.x86_64\dev_bundle\lib\node_modules\underscore\underscore.js:79:11)
at C:\tools\isobuild\bundler.js:3017:7
at C:\tools\utils\buildmessage.js:271:13
at exports.EnvironmentVariable.withValue (C:\tools\utils\fiber-helpers.js:89:14)
at C:\tools\utils\buildmessage.js:264:29
at exports.EnvironmentVariable.withValue (C:\tools\utils\fiber-helpers.js:89:14)
at C:\tools\utils\buildmessage.js:262:18
at exports.EnvironmentVariable.withValue (C:\tools\utils\fiber-helpers.js:89:14)
at C:\tools\utils\buildmessage.js:253:23
at exports.EnvironmentVariable.withValue (C:\tools\utils\fiber-helpers.js:89:14)
at Object.capture (C:\tools\utils\buildmessage.js:252:19)
at bundle (C:\tools\isobuild\bundler.js:2910:31)
at files.withCache (C:\tools\isobuild\bundler.js:2857:32)
at Object.withCache (C:\tools\fs\files.js:1664:12)
at Object.exports.bundle (C:\tools\isobuild\bundler.js:2857:16)
at Profile.run (C:\tools\runners\run-app.js:579:36)
at Function.run (C:\tools\tool-env\profile.js:490:12)
at bundleApp (C:\tools\runners\run-app.js:578:34)
at AppRunner._runOnce (C:\tools\runners\run-app.js:622:35)
at AppRunner._fiber (C:\tools\runners\run-app.js:880:28)
at C:\tools\runners\run-app.js:408:12

Any pointers?
My meteor is already at the latest version 1.6.1

@xcv58
Copy link
Owner

xcv58 commented Mar 11, 2018

Delete .meteor/local and try again. The local DB will be deleted as well.

@rakesh-agrawal
Copy link
Author

rakesh-agrawal commented Mar 11, 2018 via email

@rakesh-agrawal
Copy link
Author

Removing 8.0.0 and installing 7.1.1 version works fine..

@xcv58
Copy link
Owner

xcv58 commented Mar 11, 2018

I can't reproduce the bug. I did try on different machines.

Could you try to first remove the package, clean up everything not tracked by git under .meteor, then add the latest package again?

The change for 8.0.0 should not lead to this bug: d40c15e

@rakesh-agrawal
Copy link
Author

rakesh-agrawal commented Mar 11, 2018 via email

@rakesh-agrawal
Copy link
Author

I tried everything, even on a fresh centos machine but it did not work.
Do you have an indirect dependency on tap_i18n package?

/home/centos/.meteor/packages/tap_i18n/.1.8.2.pg5k92.3iou++os+web.browser+web.cordova/plugin.tap-i18n-compiler.os/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:116
throw error;
^

TypeError: Path must be a string. Received undefined
at assertPath (path.js:28:11)

@xcv58
Copy link
Owner

xcv58 commented Mar 12, 2018

Since I can't reproduce your bug. There is a workaround is you copy the entire fold auth0-lock to your code base, then link it under the packages folder like I did in the example:

https://github.com/xcv58/meteor-auth0/tree/master/examples/sample-app/packages

You can try whether it reproduce the same bug.

Could you also try the sample-app by run meteor --settings production.settings.json to see whether you can reproduce the bug?

@rakesh-agrawal
Copy link
Author

Hi,
    Thanks for the suggestions...

    The sample-app you provided worked.

I am trying to replicate the same in my project.
I am not an expert on meteor but I tried the following:

1. Copied auth0-lock folder inside our project code base
2. Created a packages folder inside our project code base.
3. Created xcv58_auth0-lock folder inside the packages folder
4. Created a symlink to the auth0-lock folder

	cd packages/
	ls -ltr
	total 0
	drwxrwxr-x. 3 centos centos 18 Mar 12 07:00 xcv58_auth0-lock
	lrwxrwxrwx. 1 centos centos 13 Mar 12 10:01 xcv58:auth0-lock -> ../auth0-lock

5. Updated packages file under .meteor with xcv58:auth0-lock
6. After that ran meteor -s settings.json
7. I got the error asking to install auth0-lock and auth0 packages
8. I ran meteor npm install --save auth0-lock auth0
9. Now i am getting below error:
	W20180312-15:51:10.564(0)? (STDERR) Error: Cannot find module 'auth0-lock'
	W20180312-15:51:10.564(0)? (STDERR)     at Function.Module._resolveFilename (module.js:538:15)
	W20180312-15:51:10.564(0)? (STDERR)     at Function.resolve (internal/module.js:18:19)
	W20180312-15:51:10.564(0)? (STDERR)     at Object.require (/home/centos/actifiozero/a0-ui-api/.meteor/local/build/programs/server/boot.js:288:32)
	W20180312-15:51:10.565(0)? (STDERR)     at makeInstallerOptions.fallback (packages/modules-runtime.js:651:18)
	W20180312-15:51:10.565(0)? (STDERR)     at require (packages/modules-runtime.js:244:16)
	W20180312-15:51:10.565(0)? (STDERR)     at auth0-lock-client.js (auth0-lock/auth0-lock-client.js:1:228)
	W20180312-15:51:10.565(0)? (STDERR)     at fileEvaluate (packages/modules-runtime.js:343:9)
	W20180312-15:51:10.565(0)? (STDERR)     at require (packages/modules-runtime.js:238:16)
	W20180312-15:51:10.566(0)? (STDERR)     at /home/centos/actifiozero/a0-ui-api/.meteor/local/build/programs/server/app/app.js:3770:1
	
Am i missing anything?

@xcv58
Copy link
Owner

xcv58 commented Mar 12, 2018

You can actually copy the auth0-lock folder into your packages and rename to xcv58:auth0-lock.

So eventually your meteor has packages/xcv58:auth0-lock/ with the files in auth0-lock.

@rakesh-agrawal
Copy link
Author

Thanks it worked..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants