I want to create a resource for the user when they first register. In order to do that I need the access token, of the newly created and logged in user.
I tried using Rules, but the accessToken is equal to an empty object after logging in for some reason.
function (user, context, callback) {
console.log(user);
console.log(context);
if (context.stats.loginsCount === 1) {
console.log("Creating example resource");
const options = {
method: 'POST',
uri: "http://",
headers: {
"Authorization": "Bearer " + context.accessToken
}
};
request(options, function(err, res) {
console.log(res.body);
});
}
callback(null, user, context);
}
How do I send a POST after the user has logged in?
Did you ever happen to resolve this? I just opened a similar issue…
I’m a bit stuck after lots of reading and trying. Once a user registers with Auth0 and logs in for the first time, I’d like to run a rule that makes an API request to my application to create a new user. The problem is that I need a valid JWT access token to hit my API. I thought that the access token and/or id token that the user receives once authenticating in my react app (and is subsequently used to make api requests) would be available in the rules… but it doesn’t appear to be.
Is the ac…
Thanks.
Did you guys ever get this to work? I’m stuck being unable to get an accessToken.
I have written a rule that posts a new user to my API. The rule fires when I sign up a new user. My API refuses the POST with a 401 error.
When I debug the rule, the context.accessToken is empty {}. How do I get an access token to pass to my API? I can’t make heads or tails of the rule documentation.
function (user, context, callback) {
if (context.stats.loginsCount === 1) {
return callback(null, user, context);
}
const request = require('request');
const payload = _.extend({…
mvkv
March 26, 2021, 9:14pm
4
Hi there! 2020, still having this issue… Someone had managed to resolve it?