Can't get bearer token from request in C# function #719
Unanswered
myers-gh1328
asked this question in
Q&A
Replies: 1 comment 2 replies
-
The format of accessing fields in the request body is the same for this context as for normal HTTP trigger C# functions (https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook-trigger?tabs=csharp). The following code snippet can be used to access the access token for example: string requestBody = string.Empty;
using (StreamReader streamReader = new StreamReader(req.Body))
{
requestBody = await streamReader.ReadToEndAsync();
}
dynamic data = JsonConvert.DeserializeObject(requestBody);
string accessToken = data?.accessToken; |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In the JS example for custom role assignment at https://github.com/staticwebdev/roles-function/blob/main/api/GetRoles/index.js the bearer token for calling graph is retrieved by setting a const user = req.body and then getting the token from user.accessToken
The request body in C# is a stream that does not contain anything. What is the C# equivalent to the js example code?
Beta Was this translation helpful? Give feedback.
All reactions