requestToken() never ends
See original GitHub issueHi,
First, thanks for your library. It works almost like a charm! š But I have a small issue and I canāt find a way to fix it (Iām a kind of newbie)ā¦
Using your own example (for testing purpose), Iāve set my /sendtoken
route, but the request never ends: the email containing the token is sent, the token worksā¦ but - using my example - I canāt console.log('end here')
or diplay sent
.
I tried a few things without any success.
It seems to miss a next()
, but you do not use it on your docs.
Do you have an idea whatās going on?
Thanks a lot.
const express = require('express')
const passwordless = require('passwordless')
const router = express.Router({ mergeParams: true })
var users = [
{ id: '1', email: 'myemail1@gmail.com' },
{ id: '2', email: 'myemail2@gmail.com' }
]
// POST route
router.post(
'/sendtoken',
function(req, res, next) {
console.log('enter here') // <-- I can console.log() this message
next()
},
passwordless.requestToken(function(user, delivery, callback) {
console.log('inside requesttoken') // <-- I can console.log() this message
for (var i = users.length - 1; i >= 0; i--) {
if (users[i].email === user.toLowerCase()) {
return callback(null, users[i].id)
}
}
callback(null, null)
}),
function(req, res) {
console.log('end here') // <-- I CANNOT console.log() this message
res.sent('sent')
}
)
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
React Axios - C# WebAPI request token fails without a server ...
Finally found my answer. It turns out I had not enabled CORS in my WebAPI back-end for the /token endpoint. The way I...
Read more >Troubleshooting CloudFormation - AWS Documentation
If AWS CloudFormation fails to create, update, or delete your stack, you can view error messages or logs to help you learn more...
Read more >Obtaining Access Tokens using 3-legged OAuth flow
Create a request for a consumer application to obtain a request token. Have the user authenticate, and send the consumer application a request...
Read more >(solved) Java Oauth request_token flow example, without ...
Once you get your request token are you able to poste a tweet to twitter using this code? Can you put your code...
Read more >Prevent Cross-Site Request Forgery (XSRF/CSRF) attacks in ...
A best practice is to never change state on a GET request. ... The antiforgery cookie token and request token do not match....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had the same problem - had no
callback()
cast at the end of deliveryIf anyone runs into this, make sure you call
callback()
at the end of your delivery method!