To reproduce the bug, create a new Hoodie app as described in our quick start guide. As this is just for debugging purpose, I would recommend to start the app in memory by default, for that you can add
"hoodie": {
"inMemory": true
}
to the created package.json file.
Next, letβs create a test account each time we start the app and add a token to it. For that, create an app-specific plugin. Create a hoodie/server.js file with the following content
Now when you start the app, you should see the following in the terminal
test account created
token added to test account: MY_SECRET_TOKEN
Now open http://localhost:8080 in your browser, open the console in the web developer tools and run this
hoodie.account.on('signin', function () {console.log('signin event')})
hoodie.account.on('reauthenticate', function () {console.log('reauthenticate event')})
hoodie.account.signIn({token: 'MY_SECRET_TOKEN'})
You should now see reauthenticate event being logged. And that is the bug, because it should have logged signin event instead.
Now, git clone the hoodie-account-client repository in a different folder and install its dependencies
cd ~ # change directory to somewhere outside of the hoodie app you created before
git clone git@github.com:hoodiehq/hoodie-account-client.git
cd hoodie-account-client
npm install
Then copy the current path, on Mac/Linux you can do that with the pwd command
Then change again into the directory of your app and run npm link /path/to/hoodie-account/client (where /path/to/hoodie-account/client is the path you copied above). Now when you restart your test app, it will bundle your local hoodie-account-client copy, so you can make changes and see if it fixes the problem.
Thatβs basically it :slightly_smiling_face:
:clipboard: Step by Step
[x] π Claim this issue: Comment below (or assign yourself and continue at step 4 :)
Please π only claim if you want to start working on it within a day.
Once claimed we add you as contributor to this repository.
[x] π Accept our invitation to this repository. Once accepted, assign yourself to this repository
[x] π Please review our Code of Conduct
In a nutshell: be patient and actively kind with us π
[x] π replace the up for grabs label with in progress.
[x] reproduce the bug as described above
[x] create a test in the hoodie-account-client repository which reproduces the problem.
[x] fix the problem so that the tests pass. Make sure it also works with your local test app now
[x] π Start a Pull Request. Mention closes hoodiehq/camp#123 in the description.
If this is your first, welcome :tada: :smile: Here is a great tutorial on how to send a pull request using the terminal.
[x] π Done :+1: Replace the in progress label with ready. Ask in comments for a review :)
π The Bug
Hoodie allows to sign in with a one-time token which must have been added to the user account on the server before, like so
But as described in https://github.com/hoodiehq/hoodie-account-client/issues/144, the
'signin'
event is not triggered, instead'reauthenticate'
is triggered.To reproduce the bug, create a new Hoodie app as described in our quick start guide. As this is just for debugging purpose, I would recommend to start the app in memory by default, for that you can add
to the created package.json file.
Next, letβs create a test account each time we start the app and add a token to it. For that, create an app-specific plugin. Create a
hoodie/server.js
file with the following contentNow when you start the app, you should see the following in the terminal
Now open http://localhost:8080 in your browser, open the console in the web developer tools and run this
You should now see
reauthenticate event
being logged. And that is the bug, because it should have loggedsignin event
instead.Now, git clone the hoodie-account-client repository in a different folder and install its dependencies
Then copy the current path, on Mac/Linux you can do that with the
pwd
commandThen change again into the directory of your app and run
npm link /path/to/hoodie-account/client
(where/path/to/hoodie-account/client
is the path you copied above). Now when you restart your test app, it will bundle your local hoodie-account-client copy, so you can make changes and see if it fixes the problem.Thatβs basically it :slightly_smiling_face:
:clipboard: Step by Step
Please π only claim if you want to start working on it within a day.
Once claimed we add you as contributor to this repository.
In a nutshell: be patient and actively kind with us π
up for grabs
label within progress
.hoodie-account-client
repository which reproduces the problem.closes hoodiehq/camp#123
in the description.If this is your first, welcome :tada: :smile: Here is a great tutorial on how to send a pull request using the terminal.
in progress
label withready
. Ask in comments for a review :)π€β Questions
Ping us in the Hoodie Chat or on Twitter