Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
oauth2.apib 1.70 KiB
FORMAT: 1A

# Group Authorization
*Eclipse Api RESTful API* uses OAuth2 Authorization for protected resources.

## OAuth2 Authorization [GET /oauth2/authorize{?response_type,client_id,redirect_uri,scope}]
The client must redirect to authorization server to gain an `authorization_code` which can be exchange
for an `access_token`.

+ Parameters
    + response_type (string, required) - Indicates that your server expects to receive an authorization code.
    + client_id (string, required) - The client ID you received when you first created the application.
    + redirect_uri (string, required) - Indicates the URI to return the user to after authorization is complete.
    + scope (string, required) - One or more scope values.
    + state (string, required) - A random string generated by your application for client validation.

+ Response 302
    + Attributes (OAuth valid code redirect)

## OAuth2 Token [POST /oauth2/token]
Exchange `authorization_code` for `access_token`.

+ Request
    + Attributes (OAuth grant request)

+ Response 200 (application/json)
    + Attributes (OAuth valid response)

# Data Structures
## OAuth grant request (object)
+ `grant_type`: `authorization_code` (string, required)
+ `code`: `1da42105f3e19a3046ccc1de38d00c49e280e1aa` (string, required)
+ `redirect_uri`: `https%3A//localhost/`

## OAuth valid response (object)
+ `access_token`: `fabd8667bc46717fb19f1e35855639c332f34d38` (string, required) 
+ scope: all (string, required) - scopes of current token
+ `expires_in`: 900 (number, required)
+ `token_type`: Bearer (string, required)
+ `refresh_token`: `5d50a0d1392a327a254b749dce3ccf72426b402a`

## OAuth valid code redirect (object)
+ `code`: `authorization_code`
+ `state`: `123456abcdef`