0

I searched all over the web looking for the C# .NET classes and documentation to allow me to code functional equivalent of this Python method and I can't believe it simply doesn't exist but NuGet hasn't helped and the closest Google documentation I can find is here.

What does exist is classes and examples that show how to authenticate a .NET server or Installable with Google so that it can Access various APIs (Drive etc) but I just want the simple client token Authentication that is referred to for most other languages here

As you will see Python has the google.oauth2.id_token class with its verify_oauth2_token() method and NodeJS and PHP have their verifyIdToken() methods.

Java gets a little more complicated with: -

import com.google.api.client.googleapis.auth.oauth2.GoogleIdToken;
import com.google.api.client.googleapis.auth.oauth2.GoogleIdToken.Payload;
import com.google.api.client.googleapis.auth.oauth2.GoogleIdTokenVerifier;

GoogleIdTokenVerifier verifier = new GoogleIdTokenVerifier.Builder(transport, jsonFactory)
    // Specify the CLIENT_ID of the app that accesses the backend:
    .setAudience(Collections.singletonList(CLIENT_ID))
    // Or, if multiple clients access the backend:
    //.setAudience(Arrays.asList(CLIENT_ID_1, CLIENT_ID_2, CLIENT_ID_3))
    .build();

// (Receive idTokenString by HTTPS POST)

GoogleIdToken idToken = verifier.verify(idTokenString);

But C# has diddly :-( Please advise!

If it helps I'm implementing a Javascript SSO client. (BTW have no interest in the YOLO library)

McMurphy
  • 1,235
  • 1
  • 15
  • 39
  • Can you explain why Javascript is tagged here? – Mr.DeleteMyMessages Oct 02 '18 at 12:28
  • For context/background because I'm implementing a JS SSO client the idTokens will come from https://w3c.github.io/webappsec-credential-management/ – McMurphy Oct 02 '18 at 14:05
  • https://stackoverflow.com/questions/44600214/using-google-api-googlejsonwebsignature-validateasync-in-server-call – Eliseo Roa Aug 09 '19 at 16:58
  • Solution in [validate google android token in c# server side](https://stackoverflow.com/questions/44600214/using-google-api-googlejsonwebsignature-validateasync-in-server-call) – Eliseo Roa Aug 09 '19 at 17:01

1 Answers1

1

I finally found Google C# token verification code on the web. It says it is no longer actively maintained. Why is there no MuGet package? Why is Google making this so hard?

Or just call the Google Validator like Python does?

Also see previous answer Here

McMurphy
  • 1,235
  • 1
  • 15
  • 39