Solicitar token¶
Url POST
¶
Headers¶
Content-Type: application/json Accept: application/json
Parameters¶
- grant_type * :
type: string
En este campo siempre debe ir el valor password.
- client_id * :
type: integer
Este dato se debe tomar del correo.
- client_secret * :
type: string
Este dato se debe tomar del correo.
- username * :
type: string
Este dato se debe tomar del correo.
- password * :
type: string
Este dato se debe tomar del correo.
- scope:
type: string / null
Este dato se debe tomar del correo.
Body¶
1 2 3 4 5 6 7 8 { "grant_type": "password", "client_id": 1, "client_secret": "SFTpSFOt45GCx43bwc5MEdXrbWaSyGMkBZKwIaLy", "username": "usuario@correo.com", "password": "12345" "scope": null }
Ejemplos de implementación¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 <?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://sso.emision.co/oauth/token', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => array( 'grant_type' => 'password', 'client_id' => '1', 'client_secret' => 'SFTpSFOt45GCx43bwc5MEdXrbWaSyGMkBZKwIaLy', 'username' => 'usuario@correo.com', 'password' => '12345' ), CURLOPT_HTTPHEADER => array( 'Accept': 'application/json', 'Content-Type': 'application/json' ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 import requests url = "https://sso.emision.co/oauth/token" payload={ 'grant_type': ' password', 'client_id': ' 3', 'client_secret': 'SFTpSFOt45GCx43bwc5MEdXrbWaSyGMkBZKwIaLy', 'username': 'usuario@correo.com', 'password': '12345' } files=[] headers = { 'Accept': 'application/json', 'Content-Type': 'application/json' } response = requests.request("POST", url, headers=headers, data=payload, files=files) print(response.text)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 var client = new RestClient("https://sso.emision.co/oauth/token"); client.Timeout = -1; var request = new RestRequest(Method.POST); request.AddHeader("Accept", "application/json"); request.AddHeader("Content-Type", "application/json"); request.AlwaysMultipartFormData = true; request.AddParameter("grant_type", "password"); request.AddParameter("client_id", "1"); request.AddParameter("client_secret", "SFTpSFOt45GCx43bwc5MEdXrbWaSyGMkBZKwIaLy"); request.AddParameter("username", "usuario@correo.com"); request.AddParameter("password", "12345"); IRestResponse response = client.Execute(request); Console.WriteLine(response.Content);
Responses¶
Response 200
OK¶
Si la generación del token ha sido correcta.
Nota
Estos datos deben ser almacenados de forma segura.
1 2 3 4 5 6 { "token_type": "Bearer", "expires_in": 31536000, "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1Ni89.eyJhdWQiOiIzIiwianRpIjoiNmEwMjk0MTg5OTRkYz67NmNjMzZkNzlkNzUyZDA5ZGM1OGFmODM3YTFkNzdlY2U3ODYzYjQ1M2EwYWEzYzIxYzY3NWFkZmE4M2VhMDkwNDEiLCJpYXQiOjE2MzIzMjY4ODguNzc1OTcsIm5iZiI6MTYzMjMyNjg4OC43NzU5NzQsImV4cCI6MTY2Mzg2Mjg4OC43NjYzMSwic3ViIjoiMiIsInNjb3BlcyI6W119.sleKENT4lfcDeCO5HQlgjzIaTN0mvzJifVSM75QpwIURMPKwnX78tpjvZnnliLG4T-s5g0WPErSEdk2ZfEOmsEdWryb9_DV8k2yqu4h7FboekndLTBjEJBG-c2gfzI-aFSh0_24Tf1D6A2uhP3DUxNrE1DivS51g0wztzslKPVn7TRr98txzE4bQ7OrJmTYGfQ5Ag-su1OGM3K2tbVPLetb90UxguXqun3eFsE9SMapuN3HlrPSjA4hU17qBA524tyiD_awNOWngbQN-kvZwu8NpEROq9H_5eHyBDiKPpVWju2w8Udk4gtUz8uNXObiIHxeertPcHorBQg3j0v_etG5PWk2rsoIm0kWLLw20depM1rO5MMrVR3-Ss1GuBhucvkVXTRZN6Bq1CO2UUnEWmBzBQI2BMv3DbOz7-OxIeD2YedQZbUP-InORNIltkbzQKaUmYzon7UYN9pJUuZfODg8Nap2eSUX-qs9jKV0eEb7OZJ7NEiBjScvyf0ha3fPokVM55k72GcaWyHyN1b2Em4z_zhKbA-bPGpVsQcfUn4wexrJOospq4osoavmHWQhyesH0fYGwI2ifDqiMkngUpNaWraMYIIK8CoFi-TOOfVRrF2molNDrQjnnsrTeS38oly7FV2HqeNUsbn9IlSJOlrTDn5RUqFl6DzB0Q6B9Ubjg", "refresh_token": "def50200ee895787003d6145cb8229945b0cacebccccb305b75e16837dcd9b629a5c0aefd7020f69f762272f18dac4c5fc0002b15980eb7c8c502f9ffcd497c3cd6a83d8931a51a1fc60820f4edb6d485ad5707297f1e8687ad94f88501e20bd3c7645571d7626a9cb7abb1a17f5f3118e6db7fc018b049def24ae9fc92302ae8156854f877c944fb4a90189df65ac2dd8f2eaf2bfff6e951475c1c53e3567713e16fa8597f023f38d3badc295f5b265020d8f6a306a71e18752d70b1fca8e43a86e5553aadbbc8d77328de6c087fcdccbffac13ee2da8cd0926304b327ef58390b18fb68cc0b9a69f7041c94853833ab08869407197defe355de13f60451a62b5aaab587d52c4b2f3c4b62f9028f08c5c79a8de6aa62ecea19d93d06f434b5a238fac76df0ddb65c1426a317d8a09958cddb2d55fd48b2e72ff0257e7842909d96e35a651df3eb9693b7d3db622327044ee9722c5966142aabc73ac9ab7948958" }