Murat
Murat

Reputation: 73

How to implement server side google authorization on dotnet core

I need to implement server-side validation for in-app purchases of my android application, in C# dotnet core platform which runs on linux.

I have read this page so many times and finally found about this issue which shows I'm not alone. It looks like Google currently does not directly support dotnet core fully.

Is there anyone who could achieve this using any third party library?

Upvotes: 1

Views: 1446

Answers (2)

Jon Skeet
Jon Skeet

Reputation: 1502106

The issue you linked to is about users logging in via MVC.

If you want to use a service account:

  • If your server is on Google Cloud (e.g. Compute Engine, Container Engine or App Engine) you shouldn't need to do anything
  • Otherwise, download a service account JSON file by following the instructions here and make sure the server has local access to the file then either:
    • Set the GOOGLE_APPLICATION_CREDENTIALS environment variable and use GoogleCredential.GetApplicationDefault or
    • Use the new GoogleCredential.FromFile method (introduced in 1.29.0 of the client library support package)

Upvotes: 1

Juan G Carmona
Juan G Carmona

Reputation: 2208

As far as I know .Net Core does not have an Oauth2 server implementation (yet?)...

There are few posibilities out there as commented here, but most used is Identity Server (something that can be integrated in your custom ASP Net Core project and does the job)

"IdentityServer4 is an OpenID Connect and OAuth 2.0 framework for ASP.NET Core."

Main link: http://docs.identityserver.io/en/release/index.html

Adding Support for External Authentication: http://docs.identityserver.io/en/release/quickstarts/4_external_authentication.html?highlight=google

Take a look at the Setup and OVerview part and You'll find that this would fit your needs (I'm pretty sure)

I hope it helps,

Juan

Upvotes: 1

Related Questions