You are viewing limited content. For full access, please sign in.

Question

Question

API Token Authentication

asked on August 4, 2023

He tenido problemas para autenticarme en la API de LF. Me da error al intentar de solicitar el token .NET proporcionado en Github usando la API CloudAccessKeyString de LF, pero cuando intento autenticar una clave de acceso a través de JWT con el código de muestra proporcionado, aparece el error.

response content = {"error":"invalid_client","error_description":"The specified application registration was not found.","type":"invalid_client","title":"The specified application registration was not found.","status":401,"detail":null,"instance":"/token","operationId":"254582e44e114c439716aadc5dca34a5","traceId":"00-493fe9774c3095c65a2a571c0af7cec2-91c6497f6c497dbf-00"}

 

Ya segui las intrucciones de generar el keyAccess de LaserficheCloud

 

 

0 0

Answer

SELECTED ANSWER
replied on August 4, 2023 Show version history

Looks like you are using RestSharp. It should look something like this:

Where the authKey is this value:

0 0

Replies

replied on August 4, 2023

Are you using the correct Client ID in your request? Are you able to successfully authorize through Laserfiche's Swagger playground with this information?

https://api.laserfiche.com/repository/swagger/index.html

0 0
replied on August 4, 2023

Yes, I using the correct Client Id, however I have the same error

0 0
replied on August 4, 2023

I'll try to connect to Laserfiche Cloud, not the local api

0 0
replied on August 4, 2023

Usando base64string que proporciona Cloud, me muestra el mismo error

usando base64.png
codigo usado.png
error que muestra.png
codigo usado.png (67.78 KB)
0 0
SELECTED ANSWER
replied on August 4, 2023 Show version history

Looks like you are using RestSharp. It should look something like this:

Where the authKey is this value:

0 0
replied on August 4, 2023 Show version history

I change some lines of code, but I have the same error, I use to Working Service C#

 

change code.png
same error..png
change code.png (99.15 KB)
same error..png (30.05 KB)
0 0
replied on August 8, 2023

Valide la informacion de generar el keystring, ahi fue el error, el codigo funciona, ahora me queda la duda como se valida si un token es valido o como se puede anular un token

0 0
replied on August 5, 2023

Let's Simplify it 

 HttpClient client = new HttpClient();
                string url = $"{baseURL}/Repositories/{repositoryName}/Token";
                Dictionary<string, string> data = new Dictionary<string, string>();
                data.Add("grant_type", "password");
                data.Add("username", "admin");
                data.Add("password", "admin");
                HttpResponseMessage response = client.PostAsync(url, new    FormUrlEncodedContent(data)).Result;
                string content = response.Content.ReadAsStringAsync().Result;               
                dynamic serializeResponse = JsonConvert.DeserializeObject(content);                          
                string token = serializeResponse["access_token"];

this will get you the token string without RestSharp 

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.