-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Set up code create dev and prod environments
- Loading branch information
1 parent
70e6630
commit 1017eaf
Showing
6 changed files
with
49 additions
and
6 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "auth0-flows", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const axios = require('axios'); | ||
|
||
exports.onExecutePostUserRegistration = async (event, api) => { | ||
try { | ||
const { user } = event; | ||
|
||
const userId = user.user_id; | ||
const email = user.email; | ||
|
||
const apiUrl = event.secrets.CORE_AUTH0_ACTIONS_API + '/api/auth/newuser'; | ||
|
||
const { data, status } = await axios.post( | ||
apiUrl, | ||
{ | ||
userId, | ||
email, | ||
}, | ||
{ | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: 'Bearer ' + event.secrets.AUTHORIZATION_SECRET, | ||
}, | ||
validateStatus: () => true, | ||
}, | ||
); | ||
|
||
if (status === 200) console.log(`Status: ${status} - Successfully added ${userId} to database`); | ||
else console.log(`Status: ${status} - Failed to add ${userId} to database`); | ||
} catch (error) { | ||
console.error('Error calling API:', error.message); | ||
} | ||
}; |
File renamed without changes.