I have an in-house CMS system written in ASP.NET C#, and I need to implement a few pages that can allow the user to access and alter their Google Analytics management settings using the Google Analytics management API.
I have added the Google.Apis.Analytics.v3 library from NuGet, and I managed to make it work using OAuth2 authentication.
However, the library installs several dependencies, and some of them are upgrading some of my existing DLL files. This is not good, because I have a lot of functionality in this solution and some other solutions that are based on these old DLLs.
Would it be possible to move all the Google API implementation into an external web-service and just call this from my CMS? That way, I would not have to upgrade the CMS's old references. The only problem that I've run into with this is that I have no idea how to use OAuth2 to allow the CMS user to use his own Google account since all this is now done in the web-service, and the authentication page from google will not open in the user's browser.
I don't think a web service will work. The user needs to be prompted for authentication with the web browser. You cant really do that from a web service and return the proper authentication.
The Google .net client lib uses the newest DLLs you may want to look into upgrading yours.
Related
There is a project I am working on using asp.netcore 3.1. d app is a web API and will b consumed by multiple clients(web browser, android and Windows forms). How can I build the OAuth2 server in c# to protect my API.
Most companies don't build their own Authorization Server, since it is a job for security experts. Instead they use a cloud provider, and these are often very low cost or free.
In the early days this is a good learning guide and will save you a lot of time. You can then focus on OAuth integration into your UIs and APIs.
As long as you keep security in your UI and API standards based you will then be able to easily swap between providers later - or use an open source one perhaps.
Here are a couple of resources of mine that you might find useful. My early code is in NodeJS, but based on OAuth messages, so easily translatable to .Net Core:
Setting up an Authorization Server
Initial Tutorial
OAuth Messages - see Step 16 for API Integration
I have a mobile App in Android that successfully authenticated with Google api returning id-token and also profile information. Now I need to integrate it with my login and registration which I use .net web api as backend. I found google explaind article but not with c# and nuget library and microsoft docs is little difficult to follow. It will be better if i can integrate it with Identity that visual studio provides when creating new project with user authentication generated.
thanks in advance
I resolved my confusion next day after little digging and trying>
Ok first there are two ways of authenticating with third party which i was mixing them and I got confused.
First one in which your application is web or mobile but with web view.
Second way (that I'am using) in which native android activity handle going to google api, so the resulted id-token I manually send it to my api and use this code in c# to verify, requires Google.Apis.Auth library from nuget
var Payload = await GoogleJsonWebSignature.ValidateAsync(idtoken);
See image of steps need to follow in the second way
For more info:
https://youtu.be/zZt8SFivjps
https://developers.google.com/identity/sign-in/android/start-integrating
https://developers.google.com/identity/sign-in/web/backend-auth
I have a ASP.Net Web application which uses Google drive api v3. I need to integrate it with the Google Drive UI (So that its available in the right click open with option)
As a part of the requirements I need to prompt the user to install the application.
I am trying to follow the documentation at https://developers.google.com/drive/v3/web/install
However even after numerous attempts of reinstalling the google drive api v3 i don't see the scope "drive.install".
In addition, in developers console I do not see the Install URL textbox.
As per the document :
"Install URL
You can use the Install URL if you wish to redirect your users to a special URL the first time they open your app from Drive."
Also when I just try and browse with the suggested request(https://www.googleapis.com/auth/drive.install) I get 404
I wonder if its even supported now?
Is my only option now to list the app in the Chrome Web Store ? I hope not..
Any help is appreciated !
Based from the documentation, Do not select Automatically show OAuth 2.0 consent screen when users open my application from Google Drive. This feature is deprecated. All authorization requests must be initiated by the application. You may want to check this Authorization documentation. Your application must use OAuth 2.0 to authorize requests. No other authorization protocols are supported. If your application uses Google Sign-In, some aspects of authorization are handled for you.
I have an application running on a server that periodically extracts data from Google Analytics. It doesn't issue many queries so I don't think any limit would be a problem.
I have a prototype running, however I had to provide a login a password for the authentication (in code).
I see that I can generate API keys and other kind of authentication bits and pieces in the Google APIs Console, however I am not sure how to use them and whether they can be used in place of the login/password.
It just doesn't seem right to use a user login/password to authenticate a server application.
Is there another way?
(I am using the C# client library)
You should be using OAuth 2.0. See:
http://code.google.com/p/google-gdata/source/browse/trunk/clients/cs/samples/oauth2_sample/oauth2demo.cs
for a sample OAuth workflow.
The best way to do this is with Google Service Accounts
https://developers.google.com/accounts/docs/OAuth2ServiceAccount
However, I don't know off the top of my head the best library for c#, but there does appear to be support for it in the Google library. http://code.google.com/p/google-api-dotnet-client/wiki/OAuth2#Service_Accounts
Here's a answer specifically about the PHP client.
Service Applications and Google Analytics API V3: Server-to-server OAuth2 authentication?
Is there any very simple sample applications to get started with facebook dev?
I just want to know how I would connect to facebook through silverlight, get the authentication stuff out of the way and then develop, debug and test my applications.
Do I need to be connected to a server which connects to facebook or can I do the development from my own PC which can 'talk' to facebook?
I'm also a bit worried about the updating APIs. Some of hte samples seem a bit old? I'd really like something for the latest version of silverlight/facebook API...
We are working on posting some silverlight samples to the Facebook C# SDK on Codeplex in the next week or so. You can find that SDK at http://facebooksdk.codeplex.com or http://www.microsoft.com/facebook. We will have an in browser and out of browser sample. For now, we have other samples on there that you can look at. For the most part the SDK works the same on any .Net platform.
I've been working on a SL application with facebook integration that utilizes. I use the JavaScript SDK to log the user in, then pass the access_token into my SL app via a ScriptableMember method. I then use the FacebookApp constructor that takes an access token to create a new Facebook App object. Then I can make my calls directly from the SL app, without the need for a server-side proxy.
One thing to note, in your Facebook applicaiton settings, just enter http://localhost/ without the port for your site address.
I'm eagerly awaiting a little more guidance from Nathan, as he's a developer of the C# SDK