0

Please or Register to create posts and topics.

Unable to get information via several api's

Hi.

i'm using the quickapp template and some of the api's are not available. under the hood, if i'm using swagger, i can see that i got a message for "wrong token", but my token works great in other services and i'm logged in as admin. (im using the main template without any changes yet) this cause several pages in the demo app to get empty and stuck on loading. 

Thanks in advance.

 

examples:

api/Account/users/me 
Bearer error="invalid_token"

It's not clear from your question, but did you login in swagger, or in the angular frontend?

Not all API endpoints are restricted, so it is possible that you will get a valid response from some endpoints in swagger even with an invalid or no token.

Hi dave

i'm able to login from both swagger & client side.  (i took the code from github without changes)

when i'm trying to GET/POST to an authorize api with the token i've got i get an "401 Unauthorized" from my api. again, i'm working with the updated code from github. 

more examples:

  1. authorize is success from swagger
  2. trying to execute /api/Account/users/me from swagger 
  3. getting and error : "www-authenticate: Bearer error="invalid_token" 
  4. see attached files

In the swagger UI, just above the section you pasted, there is a box labeled 'Curl'.

The first line should read:

curl -X GET "https://localhost:44350/api/Account/users/me" -H "accept: text/plain" -H "Authorization: Bearer

After that, there should be a number of lines of ASCII characters.

 

Please copy and paste all of that here and I will take a look for you.

 

 

This is the curl

i upload it to web app on azure:

curl -X GET "https://biocomsandbox.azurewebsites.net/api/Account/users/me" -H "accept: text/plain" -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IlE4LURrTDhUYTBTRVFxWmtra2xSUVEiLCJ0eXAiOiJhdCtqd3QifQ.eyJuYmYiOjE1OTc4MzE4MTQsImV4cCI6MTU5NzgzNTQxNCwiaXNzIjoiaHR0cHM6Ly9iaW9jb21zYW5kYm94LmF6dXJld2Vic2l0ZXMubmV0IiwiYXVkIjoiYmlvY29tX2FwaSIsImNsaWVudF9pZCI6InN3YWdnZXJ1aSIsInN1YiI6Ijc0NmViODQ1LTQwYzItNDU0Zi04YjNjLWQwZmY1OWY0NDZjMiIsImF1dGhfdGltZSI6MTU5NzgzMTgxMywiaWRwIjoibG9jYWwiLCJyb2xlIjoiYWRtaW5pc3RyYXRvciIsInBlcm1pc3Npb24iOlsidXNlcnMudmlldyIsInVzZXJzLm1hbmFnZSIsInJvbGVzLnZpZXciLCJyb2xlcy5tYW5hZ2UiLCJyb2xlcy5hc3NpZ24iXSwibmFtZSI6ImFkbWluIiwiZW1haWwiOiJhZG1pbkBiaW9jb20uY29tIiwicGhvbmVfbnVtYmVyIjoiKzEgKDEyMykgMDAwLTAwMDAiLCJmdWxsbmFtZSI6IkluYnVpbHQgQWRtaW5pc3RyYXRvciIsInNjb3BlIjpbImJpb2NvbV9hcGkiXSwiYW1yIjpbInB3ZCJdfQ.nxEBC3nEZYLcTBSg1vFm70cyw-SBs-C8OqBTulHRb0A5rPqlvaluzk7lyxl5wWNh04TMxUxYUOVDwQTHJNlKsXbeUhN3CpH9UhR36CnnYZxRwA0Lr-hs35ocNinem_7oE4L7Xoqm8Q9EK1vAJMVdEbfX2Ps9R85VU7DfgyWNU6l7sn0p6b0Tkhr-7aX90SrRbEmrY0zZZsMiL0Zn3u5VicU76RvtsqCAaIWtL2imYm-hxNkSxR0_pQdqKUmEoSafTm2Zyq9DopxWmu_kt4xy01F4joIlU-tqlaKSHNjFjcYYu1WwACW3yJAjFUMy-DZUAF6U2g2Um6TfijbEXbXi5g" 

on local host (client side), i get 

invalid issuer in discovery document expected: https://localhost:44350/ current: https://localhost:44350

Severity: "error", Summary: "Unable to login", Detail: "discovery_document_validation_error", Error: ""discovery_document_validation_error""

Ok I see your issue, unfortunately my azure knowledge is limited.

 

Try set the identity server authority explicitly in the config if it is not already.

 

 

 

In other words set authority url to biocomsandbox.azurewebsites.net instead of localhost, and  make sure of the port that the API is actually running on.