Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add sms provider alicloud #410

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .changeset/cool-beds-guess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
'hasura-auth': minor
---

add sms provider alicloud

required env var:
```
AUTH_SMS_ALICLOUD_ACCESS_KEY_ID=
AUTH_SMS_ALICLOUD_ACCESS_KEY_SECRET=
AUTH_SMS_ALICLOUD_ENDPOINT=
AUTH_SMS_ALICLOUD_SIGN_NAME_DEFAULT=
AUTH_SMS_ALICLOUD_TEMPLATE_CODE_DEFAULT=
```
optional env var
```
AUTH_SMS_ALICLOUD_TEMPLATE_LOCALE=
```
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,11 @@ AUTH_LOG_LEVEL=info

# JWT
AUTH_JWT_CUSTOM_CLAIMS=

# ALICLOUD SMS
AUTH_SMS_ALICLOUD_ACCESS_KEY_ID=
AUTH_SMS_ALICLOUD_ACCESS_KEY_SECRET=
AUTH_SMS_ALICLOUD_ENDPOINT=
AUTH_SMS_ALICLOUD_SIGN_NAME_DEFAULT=
AUTH_SMS_ALICLOUD_TEMPLATE_CODE_DEFAULT=
AUTH_SMS_ALICLOUD_TEMPLATE_LOCALE=
8 changes: 7 additions & 1 deletion docs/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,17 @@
| AUTH_EMAIL_PASSWORDLESS_ENABLED | Enables passwordless authentication by email. The SMTP server must then be configured. | `false` |
| AUTH_SMS_PASSWORDLESS_ENABLED | Enables passwordless authentication by SMS. An SMS provider must then be configured. | `false` |
| AUTH_SHOW_LOG_QUERY_PARAMS | Shows all query parameters in the logs. Make sure you know what you do because this setting can potentially reveal secure information. | `false` |
| AUTH_SMS_PROVIDER | SMS provider name. Only `twilio` is possible as an option for now. | |
| AUTH_SMS_PROVIDER | SMS provider name. `twilio` or `alicloud` | |
| AUTH_SMS_TEST_PHONE_NUMBERS | Comma separated list of test phone numbers which can be used without any provider set. **The verification code can be found in the logs upon sign in**. | |
| AUTH_SMS_TWILIO_ACCOUNT_SID | | |
| AUTH_SMS_TWILIO_AUTH_TOKEN | | |
| AUTH_SMS_TWILIO_MESSAGING_SERVICE_ID | | |
| AUTH_SMS_ALICLOUD_ACCESS_KEY_ID | your alicloud access key id |
| AUTH_SMS_ALICLOUD_ACCESS_KEY_SECRET | your alicloud access key secret |
| AUTH_SMS_ALICLOUD_ENDPOINT | example: "dysmsapi.aliyuncs.com" |
| AUTH_SMS_ALICLOUD_SIGN_NAME_DEFAULT | example: "阿里云短信测试" |
| AUTH_SMS_ALICLOUD_TEMPLATE_CODE_DEFAULT | example: "SMS_154950909" |
| AUTH_SMS_ALICLOUD_TEMPLATE_LOCALE | optional, example: '{"cn":{"signName": "阿里云短信测试", "templateCode":"SMS_154950909"}, "en":{"signName": "entest", "templateCode":"SMS_00000000"}}' |
| AUTH_EMAIL_SIGNIN_EMAIL_VERIFIED_REQUIRED | When enabled, any email-based authentication requires emails to be verified by a link sent to this email. | `true` |
| AUTH_ACCESS_CONTROL_ALLOWED_REDIRECT_URLS | Comma-separated list of allowed redirect URLs that can be passed on as an option. Any sub-path will be considered valid. Supports wildcards and other [micromatch patterns](https://github.com/micromatch/micromatch#matching-features) | |
| AUTH_MFA_ENABLED | Enables users to use Multi Factor Authentication. | `false` |
Expand Down
80 changes: 41 additions & 39 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,92 +23,94 @@
"changeset": "changeset"
},
"dependencies": {
"@djgrant/postgres-migrations": "^4.1.0-rc.1",
"@simplewebauthn/server": "^5.3.0",
"@alicloud/dysmsapi20170525": "^2.0.24",
"@alicloud/openapi-client": "^0.4.6",
"@djgrant/postgres-migrations": "4.1.0-rc.1",
"@simplewebauthn/server": "^5.4.5",
"axios": "0.21.1",
"bcryptjs": "^2.4.3",
"body-parser": "1.19.0",
"compare-urls": "^2.0.0",
"cors": "2.8.5",
"dot-prop": "^6.0.1",
"dotenv": "8.2.0",
"email-templates": "^10.0.0",
"email-templates": "^10.0.1",
"email-validator": "^2.0.4",
"express": "4.17.1",
"express-jsdoc-swagger": "^1.6.7",
"express-jsdoc-swagger": "^1.8.0",
"express-session": "^1.17.3",
"express-winston": "^4.2.0",
"grant": "^5.4.21",
"graphql": "16.2.0",
"graphql-request": "^3.7.0",
"graphql-tag": "2.12.6",
"gravatar": "^1.8.1",
"gravatar": "^1.8.2",
"helmet": "3.22.0",
"hibp": "9.0.0",
"http-status-codes": "^2.2.0",
"joi": "^17.4.0",
"joi-to-swagger": "^6.0.1",
"joi": "^17.9.2",
"joi-to-swagger": "^6.2.0",
"jose": "4.8.3",
"js-yaml": "3.13.1",
"json-to-graphql-query": "^2.2.0",
"jsonata": "^1.8.5",
"json-to-graphql-query": "^2.2.5",
"jsonata": "^1.8.6",
"jsonwebtoken": "^8.5.1",
"libphonenumber-js": "^1.10.6",
"libphonenumber-js": "^1.10.37",
"micromatch": "^4.0.5",
"nocache": "^2.1.0",
"node-fetch": "^2.6.1",
"node-fetch": "^2.6.12",
"nodemailer": "6.9.3",
"otplib": "12.0.1",
"pascal-case": "^3.1.2",
"pg": "^8.6.0",
"pg": "^8.11.1",
"postinstall-postinstall": "^2.1.0",
"qrcode": "1.4.4",
"random-number-csprng": "^1.0.2",
"twilio": "^3.67.1",
"twilio": "^3.84.1",
"url-join": "^4.0.1",
"uuid": "7.0.3",
"winston": "^3.8.2"
"winston": "^3.10.0"
},
"devDependencies": {
"@changesets/cli": "^2.25.2",
"@commitlint/cli": "^16.0.2",
"@commitlint/config-conventional": "^16.0.0",
"@graphql-codegen/add": "^3.1.1",
"@graphql-codegen/cli": "^2.13.7",
"@graphql-codegen/typescript": "^2.8.0",
"@graphql-codegen/typescript-graphql-request": "^4.5.7",
"@graphql-codegen/typescript-operations": "^2.5.5",
"@simplewebauthn/typescript-types": "^5.3.0",
"@changesets/cli": "^2.26.2",
"@commitlint/cli": "^16.3.0",
"@commitlint/config-conventional": "^16.2.4",
"@graphql-codegen/add": "^3.2.3",
"@graphql-codegen/cli": "^2.16.5",
"@graphql-codegen/typescript": "^2.8.8",
"@graphql-codegen/typescript-graphql-request": "^4.5.9",
"@graphql-codegen/typescript-operations": "^2.5.13",
"@simplewebauthn/typescript-types": "^5.4.0",
"@types/bcryptjs": "^2.4.2",
"@types/body-parser": "1.19.0",
"@types/cors": "2.8.6",
"@types/ejs": "3.0.2",
"@types/email-templates": "7.0.1",
"@types/express": "4.17.6",
"@types/express-session": "^1.17.5",
"@types/faker": "^5.5.7",
"@types/gravatar": "^1.8.1",
"@types/express-session": "^1.17.7",
"@types/faker": "^5.5.9",
"@types/gravatar": "^1.8.3",
"@types/hapi__joi": "16.0.12",
"@types/helmet": "0.0.45",
"@types/jest": "^27.4.0",
"@types/micromatch": "^4.0.2",
"@types/jest": "^27.5.2",
"@types/jsonwebtoken": "^8.5.9",
"@types/node": "^17.0.9",
"@types/node-fetch": "^2.5.7",
"@types/micromatch": "^4.0.2",
"@types/node": "^17.0.45",
"@types/node-fetch": "^2.6.4",
"@types/nodemailer": "6.4.0",
"@types/pg": "^7.14.11",
"@types/qrcode": "1.3.4",
"@types/random-number-csprng": "^1.0.0",
"@types/rfc2047": "^2.0.1",
"@types/supertest": "^2.0.8",
"@types/supertest": "^2.0.12",
"@types/swagger-ui-express": "^4.1.3",
"@types/url-join": "^4.0.1",
"@types/uuid": "7.0.2",
"@typescript-eslint/eslint-plugin": "2.28.0",
"@typescript-eslint/parser": "2.28.0",
"@vuepress/plugin-back-to-top": "1.4.1",
"codecov": "^3.7.1",
"commitizen": "^4.2.4",
"codecov": "^3.8.3",
"commitizen": "^4.3.0",
"cz-conventional-changelog": "3.1.0",
"dotenv-cli": "^4.1.1",
"eslint": "6.8.0",
Expand All @@ -117,19 +119,19 @@
"eslint-plugin-prettier": "3.1.3",
"faker": "^5.5.3",
"get-port": "^5.1.1",
"git-cz": "^4.8.0",
"git-cz": "^4.9.0",
"husky": "^7.0.4",
"jest": "^27.4.7",
"jest": "^27.5.1",
"jest-extended": "0.11.5",
"lint-staged": "10.1.3",
"npm-run-all": "^4.1.5",
"prettier": "^2.3.2",
"prettier": "^2.8.8",
"rfc2047": "^3.0.1",
"rimraf": "^3.0.2",
"supertest": "^6.1.6",
"ts-jest": "^27.1.3",
"supertest": "^6.3.3",
"ts-jest": "^27.1.5",
"ts-node-dev": "^1.1.8",
"tsc-alias": "^1.5.0",
"tsc-alias": "^1.8.7",
"tsconfig-paths": "3.12.0",
"typescript": "4.5.4"
},
Expand Down
Loading