Skip to content

use C# 、 MSSQL and ASP.NET MVC Framework to create a RESTful OAuth API Server. use CodeFirst to create Database and default data. use ClaimsIdentity to record identity information

Notifications You must be signed in to change notification settings

HungYiChun/RESTful-OAuth-API

Repository files navigation

First git clone this project.

Second run this project by Visual studio (build vs2015).

HomePage: image

DB Design: image

Postman Result: image

PS: First time POST will automatically create Database, So it takes a little time.

Use POSTMAN to verify

Get OAuth authentication Token: POST /token

Headers :

        {
            "Content-Type" : "application/x-www-form-urlencoded"
        }

Body :

        { 
            "grant_type" : "password", 
            "username" : "{username}",
            "password" : "{password}"
        }

return :

        {
            "access_token": "{token}",
            "token_type": "bearer",
            "expires_in": 1800
        }

Use token to get your profile: GET api/UserSelf

Headers :

        {
            "Authorization" : "bearer {token}"
        }

return :

        {
            "Id": "{Id}",
            "Email": "{Email}",
            "Username": "{Username}",
            "Password": "{Password}",
            "Name": "{Name}",
            "PhoneNumber": "{PhoneNumber}",
            "EditTime": "{EditTime}",
            "RoleName": "{RoleName}",
            "StatusName": "{StatusName}"
        }

More APIs at / Help

About

use C# 、 MSSQL and ASP.NET MVC Framework to create a RESTful OAuth API Server. use CodeFirst to create Database and default data. use ClaimsIdentity to record identity information

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages