EN / FR / DE

5.1 The POST Request

In the ontext of OAuth 2.0, the POST request refers to the HTTP request that a client sends to the authorization server to obtain an Access Token. After the user has authorized access to their data, the client is provided with an authorization code, which it sends in a POST request along with other required information (such as Client ID, Client Secret, and Redirect URI) to the token endpoint of the server. In response, the client receives an Access Token that grants it access to the user's protected resources.

Example POST Request

[
  {"key": "grant_type", "value": "authorization_code", "type": "text"},
  {"key": "code", "value": "AUTHCODE", "type": "text"},
  {"key": "redirect_uri", "value": "http://localhost", "type": "text"},
  {"key": "client_id", "value": "ch.YourID", "type": "text"},
  {"key": "client_secret", "value": "YourSecret", "type": "text"}
]

POST Request

POST https://oauth2.hin.ch/REST/v1/getoAuthToken
  grant_type=authorization_code&
  code=AUTH_CODE&
  redirect_uri=REDIRECT_URI&
  client_id=CLIENT_ID&
  client_secret=CLIENT_SECRET