Reputation: 473
I'd like to take the result of a method and use the result of that in a parameter inside another function.
Example:
public static async Task<string> GetToken(string User, string Pass)
{
//do stuff
return token;
}
public static async Task<GraphServiceClient> Auth()
{
AuthenticationHeaderValue("bearer", GetToken());
}
Obviously not a working example, but hopefully it gets the point across. GetToken is taking command line arguments, hence the need for the User+Pass strings.
Upvotes: 0
Views: 49
Reputation: 18630
you should use await
keyword
public static async Task<GraphServiceClient> Auth()
{
var token = await GetToken('username' , 'password');
AuthenticationHeaderValue("bearer", token);
}
Upvotes: 2