muellners / gateway

Collaboration Integration Automation Gateway
Apache License 2.0
0 stars 3 forks source link

Oauth Client From User #2

Closed maektwain closed 6 years ago

maektwain commented 8 years ago

When an user is registered on the system he is authorised to perform certain functions like accessing API

To complete and fulfil our requirements such as allowing user to login from third party applications, and accessing our api will require us to build an oauth2 flow where one org/merchant/developer/user/partner/ can register as a user and then can also create his client details or applications which can be used to provide him access through his own solution

Before we can interact with an OAuth 2.0 API, we must first register an application with the service. The registration process typically involves creating an account on the service’s website, then entering basic information about the application such as the name, website, logo, etc. After registering the application, you will be given a client_id and client_secret that will be used during the authorization process.

We will allow the developers/partners/consumers/merchants to create and register applications this will be consuming JSON as following

POST /account/registerapp

{
     "applicationname":"xyz",
     "callbackurl":"upscale.in?cb=",
     "applicationdescription":"Lets say that i want to reach the world top mountain and you are onto it",
}

GET /account/getapps

{
   "client_id":"randombase64encodedkey",
   "client_secret":"randombase64encoding",
   "user_details":"association with user / maybe" 
}

User will be creating as many as clients he wish to and will be authorising through those created application credentials

We will be authorising the user on the code type and grant_type from the following url

GET /oauth/authorize?

response_type=code&redirect_uri=https%3A%2F%2Fcbornet.github.io%2Fswagger-ui%2Fdist%2Fo2c.html&realm=oauth&client_id=jhipsterapp&scope=read&state=0.3902543457224965

POST /oauth/token?

grant_type=authorization_code&code= EVaPRY&redirect_uri=https://cbornet.github.io/swagger-ui/dist/o2c.html

This will ensure that consumer is logged in and can now access their api within their context