-
-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help - Getting Error 500 when I include the access token #3
Comments
Hello Lawrence, Thank you for a kind words, I am happy that you like this project. Cars-Island-On-Azure/src/web-api/CarsIsland.API/Middleware/ApiExceptionMiddleware.cs Line 36 in 4810a70
This is exception middleware and you should catch the exception details. Could you please try to check what is the exception's message? |
Hi Daniel, curiously, the 500 error seem to have gone away by itself, as the application doesn't throw that error anymore. it does, still however, return an unauthorized error when I try to post, following the same process above. is there a way we can decode the [Authorize] process to see where the error is occurring? or do you have some suggestions on how to resolve it? thanks |
Hi again Daniel, I was able to replicate the error -- it seems that when I add the word Bearer to the access token it would then throw this error. if I skipped the Bearer I would simply get the Unauthorized error. the error I get when I include Bearer and the access token during POST is: thoughts? tks |
Hi Lawrence, |
Hi Daniel, I simply used the swagger interface to test the API. here are the steps I followed:
and I then performed the steps in Swagger using "try this out" for both get(all) cars and Post carReservation. does this help? tks |
hello guys. sorry for distrurbing. did you managed to solve this? i faced with the same.. |
hello Daniel,
Tks for providing this example -- it has been very educational so far!
I have managed to replicate the api and had been trying to use it. so far, using the swagger interface, I'm able to execute cars get all without using any authorization (since it allowed anonymous).
To execute the post car reservation, I first generated a token using this link:
https://<tenantname>.b2clogin.com/<tenantname>.onmicrosoft.com/oauth2/v2.0/authorize?p=<userflowname>&client_id=<clientid>&nonce=defaultNonce&redirect_uri=https%3A%2F%2Fjwt.ms&scope=https://<tenantname>.onmicrosoft.com/<clientid>/<scopename>&response_type=code&prompt=login
. From there, I get a JWT, which I then fed into a post command:https://<tenantname>.b2clogin.com/<tenantname>.onmicrosoft.com/{{policy-name}}/oauth2/v2.0/token
, with a body that contained:grant_type=authorization_code &client_id=<application-ID> &scope=https://<tenant-name>.onmicrosoft.com/api/read &code=<jwt from previous call>.. &redirect_uri=https://jwt.ms &client_secret=<generatedsecretforapi>
This then returned an access token, which when I fed it into jwt.ms I do see the "access_as_user" scope.
I then proceeded to enter "Bearer " with the access token using the Authorize button on top.
However, when I try to post the car reservation, I get the 500 error :
the command shown was:
interestingly, the cars get all will also fail now when I include the token -- the swagger interface will include the header as well even though it doesn't seem like it's needed.
would you have any suggestions on what I can do to alleviate this issue?
thanks again
Lawrence
The text was updated successfully, but these errors were encountered: