Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
@alipay/faas-biz-web-sdk
Advanced tools
Readme
支付宝云开发身份认证服务 SDK。
import { Auth } from "tcloudauth-sdk";
// 或者在html中引用 <script src="dist/tcloudauth-sdk-bundle.js"></script>
const auth = new Auth({
envId: "your-env-id",
userPoolUid: "your-userpool-uid",
persistence: "local",
//environment: "hz",
//useHttps: true,
});
const idpUserId = "your-username";
const password = "your-password";
auth
.loginWithUsernameAndPassword(idpUserId, password)
.then((loginState) => {
if (loginState) {
// 用户名密码登录成功,有登录态
}
});
UserPool 是在云开发创建出来的,会分配一个 Uid,一般一个应用使用一个 UserPool 即可,云开发也支持创建多个。 使用 idpUserId+password 来识别用户身份,idp 为 Identity Provider 的简写,当前只支持传统用户名密码方式,后续可支持三方登陆和自定义 IDP 登陆。 登录成功后会返回 AccessToken+RefreshToken,通过 persistence 配置这两个 token 的存储位置,默认为 session:
envId: 必传,设置云开发的 envId userPoolUid: 必传,设置云开发 UserPool 的 UID environment: 环境,支持 UAT(uat)和生产(hz)环境,默认生产环境。 useHttps: 是否使用 HTTPS,默认为 true。
auth.getAuthHeader().then((res) => {
// { "x-faas-context-authorization": "......" }
});
header 的值为 AccessToken 值。
auth.refreshAccessToken().then((res) => {
// access token 刷新成功
});
AccessToken 有效期为 30 分钟,RefreshToken 有效期为 1 天,在有效期内可通过 RefreshToken 获取新 AccessToken。
auth.logout();
登出后登录态被清除。
const alipayAuthProvider = auth.alipayAuthProvider({
appId: 'your-app-id',
scope: 'auth_user'
});
//跳转到支付宝登录页面
alipayAuthProvider.loginWithRedirect();
//支付宝登录页面重定向回来后,使用重定向的返回值登录
alipayAuthProvider.getRedirectResult().then((loginState) => {
if (loginState) {
//登录成功,有登录态
}
});
appId参数是商家实际使用的 appId, scope参数可不填。
FAQs
支付宝云开发业务 SDK(WEB 端)
The npm package @alipay/faas-biz-web-sdk receives a total of 228 weekly downloads. As such, @alipay/faas-biz-web-sdk popularity was classified as not popular.
We found that @alipay/faas-biz-web-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.