Using Youtube v3 Api key - c#

I'm trying to build an youtube based app, and I'm using version 3.0 of Youtube Data API, I did register the app in Google Cloud Console and I did obtain an API Key. After that I tried to test it in a console application in Visual Studio 2010, I used a WebClient to retrieve a video search using this URL
"https://www.googleapis.com/youtube/v3/search?part=snippet&q=YouTube+Data+API&type=video&key={MY API KEY}"
I learned this from here. I used both a Browser key and a Server key, but the server sends back an error saying the request is incorrect.
So can anyone point me to the error I'm making?
PS: I am trying to make a windows phone app, and before doing so I wanted to learn how to manipulate the Youtube API first, this is why I am testing in a console application

Make sure that the YouTube Data API is enabled in the Google Developer Console. It should look something like this:
The key you are looking for is the server key, which looks something like this:
(I've truncated my key for security purposes). I now copy and paste this into my browser window:
https://www.googleapis.com/youtube/v3/search?part=snippet&q=YouTube+Data+API&type=video&key=YOURKEYWOULDGOHERE
This works for me. Start here to verify that the key is working and that the API has been enabled correctly. I suggest using the API client, because some API calls will require an OAuth 2.0 access token, not the simple API key (search API requires regular simple API key).

Related

how to make my expo (react native) android emulator access C# .net backend api using localhost?

I am trying to build mobile app using react native and expo. When I try to access C# backend for fetching data, I have a "Network request failed" issue. The backend is built using C# .net core 3.0, and there is no authentication applied. For instance, one get request is for fetching all data from database: http://localhost:5000/ref-entity/load-all/0/1
the following are the experiments I have done:
the url http://localhost:5000/ref-entity/load-all/0/1 is working in postman.
but if I use http://10.0.2.2:5000/ref-entity/load-all/0/1 in expo android emulator, I will get a "Network request failed" error.
I have figured out it is the c# backend issue, since if I build a simple backend using node.js, this url http://10.0.2.2:4000/test is absolutely working in the emulator.
I believe it must be the c# backend is blocking the access from android emulator (10.0.2.2), but nodejs is not. I still cannot figure out which configuration I should try.
I tried this and its works for me on android EMULATOR whenever I face problems like network request failure.
http://10.0.2.2:5000

C# - Edit OneNote Notebook on SharePoint using REST API

I would like to edit a OneNote NoteBook which is stored in a SharePoint Document Libary via a C# Console Application (because i want to use it to batch input pages into a notebook form a Windows 7 machine).
Url looks like this:
http_s://COMPANY.sharepoint.com/sites/SITE_ID/Documents/_New%20Tool/NOTEBOOK_NAME?d=SOME_ID
So i found this documentation for the OneNote REST API: One Note Api, and i have two questions:
How do i get/request the Bearer Token? SDKs for this seem to be only available for Universal Windows Applications
How do i get the correct API URI? As it states here i need some IDs for the URI, but i do not know which ones to use.
If anyone has any "quick start code" to begin with or a blog post, that would be great. The official examples on GitHub do not seem to be fitting my needs...
If you want to get a Bearer token from a console app, here are your options:
Get a token from somewhere else (e.g. another app that gets tokens) and temporarily copy it to your console app
Display (via a web control/browser) the sign in flow and extract the token from it into the console app. The user has to see the sign in UI at least once - there is no way around this unfortunately. The best example I can find of this is the following: https://github.com/googlesamples/oauth-apps-for-windows/tree/master/OAuthConsoleApp. You'd just have to change the URLs/scopes/AppId.
I'd suggest going with (1) or a different route (windows universal app), but if you do need it to be a console app... you'll need to essentially show a web control/browser with the sign in URL, then parse the code out of it once the user has signed in (or have the user paste it in).
Once you have the bearer token, you can read our blog post on how to use FromUrl to extract/edit content from a site.

Access Jira API using OAuth2.0 2-legged approach in .NET

How to create access token for JIRA Rest API? Of relevant data I have
User key
Private/public key combo
Jira's Rest API Oauth example assumes 3-legged approach, and is very unclear on what the actual parameters to send are (I wish Swagger is more widely used standard!).
In more detail, I have following use-case:
When creating new employee in Web Forms (ASPX) portal application I need to create new JIRA account and assign it to project (and role inside the project).
As such I would like to use OAuth2 2-legged authentication to accomplish this. I can probably hack it with Basic Authentication, but I would really like to do it properly.
Problem arises when trying to find code examples that use this approach. .NET examples are really scarce, and even examples in other languages usually use Basic Authentication (username and password transmitted on each call) or few that use 3-legged approach.
I found AnotherJiraRestClient but looking at the code it's using RestClient nuget (this is good) but with HttpBasicAuthenticator (this is bad).
I went through all Authenticators that are on offer and OAuth2AuthorizationRequestHeaderAuthenticator looks promising but it requires me to already have access token. So that is why the question in the end is "How to create access token, using 2-legged approach?"
I already created application link on JIRA's side with this settings:
Application Type: Generic Application
Outgoing Authentication: (gives 500 server error on Jira's side... but don't think it matters as I am not using it)
Incoming Authentication: OAuth
Status: Configured
Consumer Key: TEST_JIRA_KEY
Public Key: ... (generated online private/public key combo)
Atlassian currently doesn't support OAuth 2.0, but only 1.0(a).
There is a feature request for this: https://jira.atlassian.com/browse/JRA-43171
I have made an Open Source Jira client in C#, >=.NET 4.5 and fully async (with proxy support), which is available on GitHub and as a NuGet Package. See: https://github.com/dapplo/Dapplo.Jira
Today I added OAuth 1.0a support, which I got working and use the information here for testing:
https://bitbucket.org/atlassian_tutorial/atlassian-oauth-examples/src/d625161454d1?at=default
I used the public key from that repository to setup a test link on my Jira Cloud server, and use the private key in my test case.
The code for testing is here (it's commented out, as the OAuth process opens a browser, which is bad on the test-server)
https://github.com/dapplo/Dapplo.Jira/blob/master/Dapplo.Jira.Tests/JiraOAuthTests.cs
I am still looking at a way to make the certificate/private key reading easier, but in a way this is not the job for the library itself...
If there are any questions, I guess issues on GitHub are the best way to communicate.

Using Microsoft Live as an OpenID option to an ASP.NET application

Coding Platform: ASP.NET 4.0 with C#
Building a website using ASP.NET membership(forms authentication) and options to link Open IDs to it. I would like to have Microsoft Live as an OpenID option in this website. Well I have not seen Login using Windows Live ID except at forums.asp.net, but then both are Microsoft websites.
Today, I stumbled upon a website that seems to be using Microsoft Live Connect or whatever. I tried searching for it but I couldn't get any documentation regarding an API for Live Connect.
Here's the URL: http://messengerconnectidentity.mslivelabs.com/
Has anybody used this / will this work?
To implement Windows Live ID, you must register your Web site with Microsoft® as an application and receive a client ID for use with the service. Only a person who has a valid Windows Live ID can register an application and obtain a client ID. After you create the application, you can sign in and change it whenever you want.
details on;
http://msdn.microsoft.com/en-us/library/bb676626.aspx
also have a look at this;
http://weblogs.asp.net/dwahlin/archive/2007/08/17/integrate-windows-live-id-authentication-into-your-website.aspx
I've just heard about this on a live seminar, which spoked for OpenId and Windows Live. Have a look at http://www.dotnetopenauth.net/openid/ which may be a direction to point this issue?

Writing Facebook apps in C#

I am a C# developer and fancy the idea of writing a C# app or two to integrate with the Facebook API. I read from this page:
http://wiki.developers.facebook.com/index.php/User:C_Sharp
that there's this Microsoft SDK for Facebook Platform that has binary assemblies that I can use to write my C# app. As a start, I want to try out the example mentioned on the above-mentioned page -- one that gets me a friend list.
The problem is: I am completely new to this Facebook development thing and I see I am going to need, at the very least, an API Key and some Facebook service Secret key or some such, to begin writing some code.
Do I also need a developer account? Where do I get all these things from?
Use the Facebook Developers application. With this application you can register a new application with Facebook and manage all your applications as well. Each registered application has associated API key and application secret.
To create a new application click on the + Set Up New Application button.
Note that if anyone gets a hold of the API key and the application secret, they can impersonate your application, so keep those safe.

Categories

Resources