Skip to content

Instantly share code, notes, and snippets.

View anshulxyz's full-sized avatar
🦀

Anshul Chauhan anshulxyz

🦀
View GitHub Profile
@anshulxyz
anshulxyz / rule.js
Last active May 7, 2022 15:48 — forked from vktr/rule.js
Add Stripe Customer Id to Auth0 user's metadata, and Auth0 id to Stripe Customer's metadata via custom rule
function (user, context, callback) {
user.app_metadata = user.app_metadata || {};
// Checking if the Auth0 User already has a stripe customer id with it's metadata
if ('stripe_customer_id' in user.app_metadata) {
console.log(user);
return callback(null, user, context);
}
var stripe = require('stripe')('sk_test_tyd8...');