Hello Community,
I'm using consume API for fetching Data from Azure Portal.
Firstly, I fetched token value by passing credentials in the Post Request. After getting my token value I want to fetch data by passing Subscription ID and other parameters.
In Authorization Part I'm passing "Bearer" + "Token value" but it is giving invalid token id and authorization is provided in invalid format.
Can anyone help me how to fetch values from token value?
Thank you.
Hi,
no, the error indicates that the Authorization header itself is missing. If you have the wrong scopes you get another error 403.
Delete that OnBeforeRequest action. You dont need it. At least for simple API calls to Azure/Graph.
Check the configuration of your Authorization Input Property. Should look like this
Send In Header is important!
The input parameter must contain the word "Bearer" followed by space then followed by your Azure OAuth Token.
You can also check out my article here https://medium.com/itnext/getting-started-with-outsystems-and-microsoft-graph-123006356d41
This explains the steps to use Graph API, but the procedure is the same for Azure Management API.
Best
Stefan
Have you tried adding your token directly to the API header? I can see from your screenshot that your 'Authorization' field is empty, and that your error message says 'The authentication failed because of missing 'Authorization' header".
You should have something like this
here i have a function to return the token, but you h=can have what fits your solution.
Hope this helps!
Hello Laura,
Thank you for your response.
Can you tell me from where I can get this GetToken action? I searched in dependencies but not found :(
Any time :)
This was built by our team, there's no dependency you can add to your app. You need to add your data instead of the 'GetToken' function that you see there. Add you '"Bearer" + "Token value" '
As per your advice, I tried this also. But the error is same.
Is there any other way to solve this? I ran my hands back and forth and browsed a lot but didn't find any.
did you remove the previous authentication logic? The one you have in the assigns?
Yes I did.
I'm stuck on this since 2 weeks
But you still have the logic in the on before request
Yes Ma'am,
I deleted the logic after you said and checked again, but the error was same
In your Screenshot above you assigned something to the Basic Authentication. That is incorrect for Bearer Token Authentication.
Add to the Authorization Header "Bearer " + YourToken. Please note the space between Bearer and your token. and leave the basic credentials empty.
Also make sure that you have associated the rights permission scopes in your Azure App registration.
Hello Stefen,
Is it possible that if I haven't associated the permissions scopes then this message will appear?
As the error shows regarding authorization and bearer token.
Thank you Stefen,
I Followed your steps,
But it is coming same :(
Yes, because you didnt fill in the Authorization Header. Here you have to put in "Bearer <Token>". The Test windows does not respect other transformations or configurations you made.
Thank You @Stefan Weber and @Laura Fidalgo for your help.
The error is Solved.
Thank you @Stefan Weber again for your blog you provided. It is so helpful.