The return type of your function is Task<bool>
, not bool
itself. To get the result, you should use await
keyword:
bool result = await authentication();
You can read "What Happens in an Async Method" section of this MSDN article to get more understanding on async / await
language feature.