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 "grant_type": "password", 3 "client_id": 1, 4 "client_secret": "SFTpSFOt45GCx43bwc5MEdXrbWaSyGMkBZKwIaLy", 5 "username": "usuario@correo.com", 6 "password": "12345" 7 "scope": null 8}
Ejemplos de implementación¶
1<?php 2 3$curl = curl_init(); 4 5curl_setopt_array($curl, array( 6 CURLOPT_URL => 'https://sso.emision.co/oauth/token', 7 CURLOPT_RETURNTRANSFER => true, 8 CURLOPT_ENCODING => '', 9 CURLOPT_MAXREDIRS => 10, 10 CURLOPT_TIMEOUT => 0, 11 CURLOPT_FOLLOWLOCATION => true, 12 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, 13 CURLOPT_CUSTOMREQUEST => 'POST', 14 CURLOPT_POSTFIELDS => array( 15 'grant_type' => 'password', 16 'client_id' => '1', 17 'client_secret' => 'SFTpSFOt45GCx43bwc5MEdXrbWaSyGMkBZKwIaLy', 18 'username' => 'usuario@correo.com', 19 'password' => '12345' 20 ), 21 CURLOPT_HTTPHEADER => array( 22 'Accept': 'application/json', 23 'Content-Type': 'application/json' 24 ), 25)); 26 27$response = curl_exec($curl); 28 29curl_close($curl); 30echo $response;1import requests 2 3url = "https://sso.emision.co/oauth/token" 4 5payload={ 6 'grant_type': ' password', 7 'client_id': ' 3', 8 'client_secret': 'SFTpSFOt45GCx43bwc5MEdXrbWaSyGMkBZKwIaLy', 9 'username': 'usuario@correo.com', 10 'password': '12345' 11} 12files=[] 13headers = { 14 'Accept': 'application/json', 15 'Content-Type': 'application/json' 16} 17 18response = requests.request("POST", url, headers=headers, data=payload, files=files) 19 20print(response.text)1var client = new RestClient("https://sso.emision.co/oauth/token"); 2client.Timeout = -1; 3 4var request = new RestRequest(Method.POST); 5request.AddHeader("Accept", "application/json"); 6request.AddHeader("Content-Type", "application/json"); 7request.AlwaysMultipartFormData = true; 8request.AddParameter("grant_type", "password"); 9request.AddParameter("client_id", "1"); 10request.AddParameter("client_secret", "SFTpSFOt45GCx43bwc5MEdXrbWaSyGMkBZKwIaLy"); 11request.AddParameter("username", "usuario@correo.com"); 12request.AddParameter("password", "12345"); 13 14IRestResponse response = client.Execute(request); 15Console.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 "token_type": "Bearer", 3 "expires_in": 31536000, 4 "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1Ni89.eyJhdWQiOiIzIiwianRpIjoiNmEwMjk0MTg5OTRkYz67NmNjMzZkNzlkNzUyZDA5ZGM1OGFmODM3YTFkNzdlY2U3ODYzYjQ1M2EwYWEzYzIxYzY3NWFkZmE4M2VhMDkwNDEiLCJpYXQiOjE2MzIzMjY4ODguNzc1OTcsIm5iZiI6MTYzMjMyNjg4OC43NzU5NzQsImV4cCI6MTY2Mzg2Mjg4OC43NjYzMSwic3ViIjoiMiIsInNjb3BlcyI6W119.sleKENT4lfcDeCO5HQlgjzIaTN0mvzJifVSM75QpwIURMPKwnX78tpjvZnnliLG4T-s5g0WPErSEdk2ZfEOmsEdWryb9_DV8k2yqu4h7FboekndLTBjEJBG-c2gfzI-aFSh0_24Tf1D6A2uhP3DUxNrE1DivS51g0wztzslKPVn7TRr98txzE4bQ7OrJmTYGfQ5Ag-su1OGM3K2tbVPLetb90UxguXqun3eFsE9SMapuN3HlrPSjA4hU17qBA524tyiD_awNOWngbQN-kvZwu8NpEROq9H_5eHyBDiKPpVWju2w8Udk4gtUz8uNXObiIHxeertPcHorBQg3j0v_etG5PWk2rsoIm0kWLLw20depM1rO5MMrVR3-Ss1GuBhucvkVXTRZN6Bq1CO2UUnEWmBzBQI2BMv3DbOz7-OxIeD2YedQZbUP-InORNIltkbzQKaUmYzon7UYN9pJUuZfODg8Nap2eSUX-qs9jKV0eEb7OZJ7NEiBjScvyf0ha3fPokVM55k72GcaWyHyN1b2Em4z_zhKbA-bPGpVsQcfUn4wexrJOospq4osoavmHWQhyesH0fYGwI2ifDqiMkngUpNaWraMYIIK8CoFi-TOOfVRrF2molNDrQjnnsrTeS38oly7FV2HqeNUsbn9IlSJOlrTDn5RUqFl6DzB0Q6B9Ubjg", 5 "refresh_token": "def50200ee895787003d6145cb8229945b0cacebccccb305b75e16837dcd9b629a5c0aefd7020f69f762272f18dac4c5fc0002b15980eb7c8c502f9ffcd497c3cd6a83d8931a51a1fc60820f4edb6d485ad5707297f1e8687ad94f88501e20bd3c7645571d7626a9cb7abb1a17f5f3118e6db7fc018b049def24ae9fc92302ae8156854f877c944fb4a90189df65ac2dd8f2eaf2bfff6e951475c1c53e3567713e16fa8597f023f38d3badc295f5b265020d8f6a306a71e18752d70b1fca8e43a86e5553aadbbc8d77328de6c087fcdccbffac13ee2da8cd0926304b327ef58390b18fb68cc0b9a69f7041c94853833ab08869407197defe355de13f60451a62b5aaab587d52c4b2f3c4b62f9028f08c5c79a8de6aa62ecea19d93d06f434b5a238fac76df0ddb65c1426a317d8a09958cddb2d55fd48b2e72ff0257e7842909d96e35a651df3eb9693b7d3db622327044ee9722c5966142aabc73ac9ab7948958" 6}
Response 401 Unauthorized¶
Si los datos ingresados son incorrectos.
1{ 2 "message": "Estas credenciales no coinciden con nuestros registros." 3}