Azure / api-management-samples

MIT License
138 stars 137 forks source link

JWT is not well formed error only in api Test tab in Azure Portal #31

Closed keithdv closed 4 years ago

keithdv commented 4 years ago

If I call thru postman or powershell invoke-restmethod it works. I try to add the token in an Authorization header in the 'Test' portion of the api in Azure API Management Services I get the following error. You can grab the encoded token, go to jwt.io and see that it is encoded. Any ideas??

IDX12709: CanReadToken() returned false. JWT is not well formed: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IkhsQzBSMTJza3hOWjFXUXdtak9GXzZ0X3RERSIsImtpZCI6IkhsQzBSMTJza3hOWjFXUXdtak9GXzZ0X3RERSJ9.eyJhdWQiOiJhcGk6Ly9henVyZWFwaW1hbmFnZW1lbnQtYXBpZ2F0ZXdheSIsImlzcyI6Imh0dHBzOi8vc3RzLndpbmRvd3MubmV0L2MxZWI1MTEyLTc5NDYtNGM5ZC1iYzU3LTQwMDQwY2ZlM2E5MS8iLCJpYXQiOjE1ODIy MjQ2NDIsIm5iZiI6MTU4MjIyNDY0MiwiZXhwIjoxNTgyMjI4NTQwLCJhY3IiOiIxIiwiYWlvIjoiQVRRQXkvOE9BQUFBd2JZQ1FseXg4UndnblZRaXZib3FFeVlJbzBra1FJNHFoRHRycVU0NzV3K1p0S2E3R1ZCNkJKc2VkZ1dhTWt3NiIsImFtciI6WyJwd2QiXSwiYXBwaWQiOiIwZTYxMjJmMi0wZjRmLTRhYTgtYTQyZC1jMmM5YzdlMmM4ZDMiLCJhcHBpZGFjciI6IjEiLCJmYW1pbHlfbmFtZSI6I lZvZWxzIiwiZ2l2ZW5fbmFtZSI6IktlaXRoIiwiaXBhZGRyIjoiNzMuOTQuMTA2LjIwNSIsIm5hbWUiOiJWb2VscywgS2VpdGgiLCJvaWQiOiJmYzgwOTIwOS04Y2RmLTRhNzMtOTQ5YS05MGRhODlkMTg2MjgiLCJvbnByZW1fc2lkIjoiUy0xLTUtMjEtMzM0MzgzNDIyMi0yMDMxNzkzODIwLTMxNzI3MDExMTgtMTcxMjc2MSIsInNjcCI6IlNjb3BlQSIsInN1YiI6ImdmSGt1M0Q4NmJCc1B4RS1hWH J2VmVYejRfUE0yLXh5RlJ5bFNKdG9jMWciLCJ0aWQiOiJjMWViNTExMi03OTQ2LTRjOWQtYmM1Ny00MDA0MGNmZTNhOTEiLCJ1bmlxdWVfbmFtZSI6ImtlaXRoLnZvZWxzQGVjb2xhYi5jb20iLCJ1cG4iOiJrZWl0aC52b2Vsc0BlY29sYWIuY29tIiwidXRpIjoiX2xZRGxOV1VnVUdsMDM2X1ZVZE1BQSIsInZlciI6IjEuMCJ9.XfFOyHnwuS63tngOAksKFJBjEu5CrDo9KqJiBIP1v8lreE-CADN9PB 0ZqtBqw3ipam8_TlaHK9CCdeB51lb0O2EjuOk0n8phkNraYVh75QtOzcQOyQMfkchL5xgosUbukj93xG3j2WtrDOD78foBsyUfN18mT3WhQ_FknvHLmiz0ShoapDZHpmUDAQDWiXWjcQNdSDXxoAgCk2MobGjzawvmn0G0ABZm_B9C7sgTiFSdALw0IE6Vp2ZzRElXD6c-jlM60aAVPQ_Stn0N1RWR54J0gjNPlnj-QZX9vd22ApCmZKgjkX-fxjL-RBOZRXjLod6d1LRE2J_Q1VrOHPIQ9w'. The token needs to be in JWS or JWE Compact Serialization Format. (JWS): 'EncodedHeader.EndcodedPayload.EncodedSignature'. (JWE): 'EncodedProtectedHeader.EncodedEncryptedKey.EncodedInitializationVector.EncodedCiphertext.EncodedAuthenticationTag'.

  | outerMethod | validate-jwt

keithdv commented 4 years ago

My issues are around using https://login.microsoftonline.com/ecolab.com/**v2.0**/.well-known/openid-configuration. From what I am experiencing it is good to include https://login.microsoftonline.com/ecolab.com/.well-known/openid-configuration and https://login.microsoftonline.com/ecolab.com/**v2.0**/.well-known/openid-configuration