Skip to content

Commit dc02300

Browse files
authored
Merge pull request #301 from scientist-softserv/135-set-webhook-in-refreshAccessToken
135-set-webhook-in-refreshAccessToken
2 parents b9b23dc + bbc5dbc commit dc02300

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pages/api/auth/[...nextauth].js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ const refreshAccessToken = async (token) => {
8888
throw refreshedTokens
8989
}
9090

91+
// add the webstore webhook if it isn't there
92+
const data = await getWebhookConfig(refreshedTokens.access_token)
93+
if(!data?.id) {
94+
createWebhookConfig(refreshedTokens.access_token)
95+
}
96+
9197
return {
9298
...token,
9399
accessToken: refreshedTokens.access_token,

0 commit comments

Comments
 (0)