I can get my list of youtube videos using google .NET client libraries following the example in the following link
https://developers.google.com/youtube/v3/code_samples/dotnet
This works fine when I am using it in a console application and my project's Client Id is of type 'Installed Application'.
I want to make it work for my web application. I created a client id of type 'Web Application' and provided appropriate redirect_uri. When I run the application, it always generates a random redirect_uri in the request and I am getting redirect_uri mismatch error. How can I fix this problem? What am I missing?
Did you follow the instructions on https://developers.google.com/api-client-library/dotnet/guide/aaa_oauth#web_applications?
It contains code snippets and explanations about the 'redirect URI' you need to register in Google Developers Console (The URI should look like: your_site/AuthCallback/IndexAsync).
If you choose to create a ASP.NET (NOT MVC) application, you can take a look in the following sample: https://code.google.com/p/google-api-dotnet-client/source/browse?repo=samples#hg%2FTasks.ASP.NET.SimpleOAuth2.
Related
I followed the tutorial here, except that I implemented it in a web app, and everything works fine in localhost, when I call the API to get calendar events for a give date, I get the events list back. However when I deploy to my test site I get a 502 Bad Gateway response, making the same call as in localhost.
Has anybody experienced the same? How to fix it?
If it works on localhost and not on deployment, it just means there are configurations which haven't been met. Check this Web applications (ASP.NET MVC) about setting up web apps using ASP.NET.
In order to run the following code successfully, you must first add a
redirect URI to your project in the Google API Console. Since you will
use FlowMetadata and its default settings, set the redirect URI to
your_site/AuthCallback/IndexAsync.
I have a hyperlink in a Web Forms project and it's href is set to a web api call.
http://www.domain1.com/form.aspx has
Test
"houston" is the parameter.
I get a 404 error when I click on the link. When I debug my Web API 2 application using the link above, everything works fine. But the Web forms application cannot seem to find it. I have also tried:
Test
I have even tried:
Test
My project on "domain2" is in MVC Web API 2. What am I doing wrong? I'm missing something.
I'm not getting any data back in return or waiting for any event. It simply opens in a new tab and only needs the parameter and returns nothing back to the calling page. Is it a routing issue? TIA!
In this case, the route worked fine. The compiled dll was missing from the server, which is why it worked locally but when called from another website, the 404 error popped up. Once I copied the dll to the right folder on the server, everything worked fine.
I am trying to integrate Microsoft account login to my ASP.NET Core application. I have setup a microsoft application in the Microsoft Application Registration portal with the given redirect URI.
Here is a snippet from the Startup.cs file.
// Add external authentication middleware below. To configure them please see http://go.microsoft.com/fwlink/?LinkID=532715
app.UseMicrosoftAccountAuthentication(new MicrosoftAccountOptions()
{
// I can't post my secrets here
ClientId = "my_client_id",
ClientSecret = "my_client_secret"
});
When I run the app and login via Microsoft, I get redirected to the Microsoft Login page.
It has the following query parameters (with the id's removed)
client_id:my_client_id
scope:https://graph.microsoft.com/user.read
response_type:code
redirect_uri:https://localhost:44328/signin-microsoft
state:the_state
When I sign in with my microsoft personal account, I got redirected to an error page instead.
The URL says The+provided+value+for+the+input+parameter+'redirect_uri'+is+not+valid.+The+expected+value+is+'https://login.live.com/oauth20_desktop.srf'+or+a+URL+which+matches+the+redirect+URI+registered+for+this+client+application
I verified that my redirect URL in the microsoft app is exactly the same as the redirect url passed to the Microsoft log in page so I don't know what's the issue.
Another weird thing though if I log in using a Work or School account, I can proceed properly and it redirects me to the callback page.
Can anyone please help me on this? Thank you.
Double check if you are using latest version of authentication middleware in your project (there was few changes few week ago due to changes in MS OAuth - now v2 it's in use).
Double check if you have created app under new v2 endpoint - read more here: How to register an app with the v2.0 endpoint.
Double check if you have created password for your app on Microsoft Site.
Check Live SDK support option in 'Advenced' section - this should be enabled (at least in my case, but look like this doesn't help in your).
Here you can find more information:
Microsoft account is experiencing technical problems. Please try again later. (GitHub #827)
External login via Microsoft Account failed on RC2/RC3 (GitHub #866)
Enabling authentication using external providers
Update:
Ok, I see now - you have two things:
missing https (ssl), see this post,
different port number - it means that is different url and this is reason of your problem - you'r using different url than registered with your app:
http://localhost:54554/signin-microsoft - registred in app
https://localhost:44328/signin-microsoft - form your error message
I have the same problem.
I use Microsoft Oauth 2.0 to solve this problem. You can find MVC .net sample at https://azure.microsoft.com/en-us/documentation/articles/active-directory-appmodel-v2-overview/
I'm trying to follow this tutorial for Google's Analytics API.
The tutorial says "If you haven't already registered your application with the Google Developers Console, then set up a project and application in the Developers Console".
The documentation for the Developers Console says "A project consists of a set of applications...", which makes sense.
I'm able to create the project, but I don't see any way to create an application within that project. Both pieces of documentation linked above instruct me to click on "Registered apps" in the left sidebar, but there is no such link. (I believe these docs were written for an older version of the Console.)
On the recommendation of another poster, I tried using the old Console instead, but I can't find any "Registered apps" link (or any other way to create an application) in that version, either.
Any ideas?
You didn't say whether you were doing this as a service account, web app, or installed app but this should get you pointed in the right direction for all of those.
And, Google radically changed the console UI.
The application gets created when you create the credentials for an application type.
If you created the project in the Google Console, select the project and follow the instructions in the tut you linked to:
Go to the Google Developers Console.
Select a project.
In the sidebar on the left, select APIs & auth. In the displayed list of APIs, make sure all the APIs you are using show a status of ON.
In the sidebar on the left, select Credentials.
Add this step: Click on the "Create New Client ID" button then select the application type.
In either case, you end up on the application's credentials page.
To find your application's client ID and client secret, and set a redirect URI, expand the OAuth 2.0 Client ID section.
Write down the values for each of these fields:
Client ID
Client secret
I am trying to get my first hello world application on facebook using asp.net with facebook toolkit.
I am hosting my files on www.aspspider.info/jasminm89/ using it as a canvasurl
and link to my facebook app is http://apps.facebook.com/mytesterapp/
At that location i have: default.html page with the h1 tag with plain text.
When I visit my app on facbook I get message:
The page cannot be displayed
The page you are looking for cannot be displayed because an invalid
method (HTTP verb) was used to attempt access. Please try the
following:
Contact the Web site administrator if you believe that this request
should be allowed. Make sure that the Web site address displayed in
the address bar of your browser is spelled and formatted correctly.
HTTP Error 405 - The HTTP verb used to access this page is not
allowed. Internet Information Services (IIS)
Technical Information (for support personnel)
Go to Microsoft Product Support Services and perform a title search
for the words HTTP and 405. Open IIS Help, which is accessible in IIS
Manager (inetmgr), and search for topics titled Setting Application
Mappings, Securing Your Site with Web Site Permissions, and About
Custom Error Messages.
here source code from facebook, where it loads my page:
<form action="http://aspspider.info/jasminm89/"
method="post" target="iframe_canvas"
id="canvas_iframe_post_4e513da6b75410144827584"
onsubmit="return Event.__inlineSubmit(this,event)"><input
type="hidden" autocomplete="off" name="signed_request"
value="xxx....."></form>
One point here.
I setup my account on 000webhost.com and by default there is default.php created,
I copy the link to my facebook and it loads the page, it worked as well with plain index.html.
final
This error is because with IIS we can't use static html pages to be called in this way
I now upload plain .aspx page with some text and it worked.
First this sounds like an error with your server configuration, not with accessing the Facebook API/SDK.
Secondly, don't you need to add the call to the facebook SDK and include the <div id="fb-root"></div> ?
Or are you using the C# Facebook SDK?
I iis you can not handle post method coming from facebook including signed_request.
So firstly reconfigure IIS allowing handle post method. Or for simple start make index.html as the default document, put inside "hello world", then process the second step.