Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jurabek/identityserver4.phonenumberauth
Sample passwordless phone number authentication using OAuth in ASP.NET Core 2.2
https://github.com/jurabek/identityserver4.phonenumberauth
asp-net-core authentication-middleware identityserver identityserver4 identiy jwt mobile-authentication net-core oauth oauth2 oidc openid passwordless-authentication phone-authentication sms-activate
Last synced: about 6 hours ago
JSON representation
Sample passwordless phone number authentication using OAuth in ASP.NET Core 2.2
- Host: GitHub
- URL: https://github.com/jurabek/identityserver4.phonenumberauth
- Owner: jurabek
- License: mit
- Created: 2018-02-26T15:36:37.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-01-20T09:01:43.000Z (almost 3 years ago)
- Last Synced: 2024-02-29T07:34:32.590Z (8 months ago)
- Topics: asp-net-core, authentication-middleware, identityserver, identityserver4, identiy, jwt, mobile-authentication, net-core, oauth, oauth2, oidc, openid, passwordless-authentication, phone-authentication, sms-activate
- Language: C#
- Homepage:
- Size: 61.5 KB
- Stars: 98
- Watchers: 8
- Forks: 32
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://datatracker.ietf.org/doc/html/rfc6749#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`
```console
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
```console
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
```console
curl -i http://localhost:62732/api/Identity \
-H "Authorization: Bearer CfDJ8F2fHxOfr9xAtc......"
``````json
{
"type": "phone_number",
"value": "+198989822"
}
```