百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
I

IdentityServer4.PhoneNumberAuth

> 安全
开源

使用 OAuth 在 ASP.NET Core 2.2 中进行无密码电话号码验证示例

99 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

使用 OAuth 在 ASP.NET Core 2.2 中进行无密码电话号码验证示例

IdentityServer4.PhoneNumberAuth

Sample passwordless phone number authentication with IdentityServer4 in ASP.NET Core 3.1

ATTENTION: This implementation is not fully rfc6749 complient, for creating custom grant_type's follow instructions in section 8.3

NOTE: To be able to test locally you can change "ReturnVerifyTokenForTesting : true" on appsettings.json it will returns us verify_token on response, however in production usages it must be removed and you should add real SMS service (Twilio, Nexmo, etc..) by implementing ISmsServices

bash
curl -H "Content-Type: application/json" \ 
     -X POST \ 
     -d '{"phonenumber":"+198989822"}' \ 
     http://localhost:62537/api/verify_phone_number
json
{
    "resend_token": "CfDJ8F2fHxOfr9xAtc...",
    "verify_token": "373635"
}

Authentication by verification token

bash
curl -H "Content-Type: application/x-www-form-urlencoded" \
     -X POST \ 
     -d 'grant_type=phone_number_token&client_id=phone_number_authentication&client_secret=secret&phone_number=%2B198989822&verification_token=373635' \ 
      http://localhost:62537/connect/token
json
{
    "access_token": "CfDJ8F2fHxOfr9xAtc......",
    "expires_in": 3600,
    "token_type": "Bearer",
    "refresh_token": "CfDJ8F2fHxOfr9xAtc...."
}

Test your api controller by Bearer token

bash
curl -i http://localhost:62732/api/Identity \
     -H "Authorization: Bearer CfDJ8F2fHxOfr9xAtc......"
json
{
    "type": "phone_number",
    "value": "+198989822"
}

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#asp-net-coreauthentication-middlewareidentityserveridentityserver4

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类安全
定价开源

> 相关工具

O
OWASP ZAP
开源 Web 应用安全扫描器
O
owasp-wstg-tracker
Simple web app to track OWASP WSTG security testing progress
H
homebridge-mi-gateway-security
XiaoMi Gateway Security plugin for HomeBridge.