Created
September 19, 2022 08:15
-
-
Save abiral/cac024a849661dff43842758ac4104c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require("axios").default; | |
const CLIENT_ID = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; | |
const CLIENT_SECRET = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; | |
const PHONE = process.argv[2]; | |
const DOMAIN = 'xxxxxx.us.auth0.com'; | |
const options = { | |
method: 'POST', | |
url: `https://${DOMAIN}/passwordless/start`, | |
headers: {'content-type': 'application/json'}, | |
data: { | |
client_id: CLIENT_ID, | |
client_secret: CLIENT_SECRET, | |
connection: 'sms', | |
phone_number: PHONE, | |
send: 'code' | |
} | |
}; | |
axios.request(options).then(function (response) { | |
console.log(response.data); | |
}).catch(function (error) { | |
console.error(error); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require("axios").default; | |
const CLIENT_ID = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; | |
const CLIENT_SECRET = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; | |
const PHONE = '+xxxxxxxxxxxxx; | |
const DOMAIN = 'xxxxxx.us.auth0.com'; | |
const OTP = process.argv[2]; | |
const options = { | |
method: 'POST', | |
url: `https://${DOMAIN}/oauth/token`, | |
headers: {'content-type': 'application/json'}, | |
data: { | |
grant_type: 'http://auth0.com/oauth/grant-type/passwordless/otp', | |
client_id: CLIENT_ID, | |
client_secret: CLIENT_SECRET, | |
username: PHONE, | |
otp: OTP, | |
realm: 'sms', | |
audience: 'http://localhost:4000', | |
scope: 'openid profile email' | |
} | |
}; | |
axios.request(options).then(function (response) { | |
console.log(response.data.access_token); | |
}).catch(function (error) { | |
console.error(error); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment