Using Google API GoogleJsonWebSignature.ValidateAsync(…) in server call

前端 未结 3 634
谎友^
谎友^ 2021-01-29 08:46

I am trying to implement Google SSO in my C# web application. It seemed to be pretty straightforward. Based on this tutorial, Google does its magic in the web browser

3条回答
  •  遥遥无期
    2021-01-29 09:20

    Although brand new to this async/await paradigm, I do have some experience in AngularJS / NodeJS promises / callbacks.

    But not use Typescript, right?

    My challenge is that it seems async methods can only be called by other async methods all the way back up the call-stack.

    They should. Bad things can happen if you don't.

    I think it means ending the service call before the async response finishes and the service can act on the result.

    No! The compiler generates a state machine for methods with the async modifier and the await keyword means "go do something else and I'll come back here when I'm done".

    Also, for creating unit tests, putting async into the [TestMethod] method makes it completely disappear from the test explorer. I'm not sure how to test/debug this conundrum.

    You're probably making your test methods async void. They should be async Task in order for the test engine to know when the test is done.

    Have a look at Stephen Cleary's blog. He has lots of content on async-await.

提交回复
热议问题