ASP.NET site authorization issue with google and youtube api's - asp.net

I have implemented several google APIs in my website - to enbale contacts import and youtube uploads.
while everything works great locally (under my own development server's localhost), there are some problems using them thru the site (hosted on both HostGator and 1and1 and i get the same errors everywhere) - seems like
authentication problems.
the site is on ASP.NET 2.0 and these are the error msgs i get:
Error For google contacts (using AuthSub) - this happens after the I successfully receive a session token from google's authsub:
The remote server returned an error: (401) Unauthorized.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.Net.WebException: The remote server returned an error: (401) Unauthorized.
Source Error:
Line 493: ContactsQuery query = new ContactsQuery(ContactsQuery.CreateContactsUri("default"));
Line 494:
Line 495: ContactsFeed feed = service.Query(query);
Line 496:
Line 497: ArrayList emails = new ArrayList();
Source File: d:\inetpub\vhosts\e-koren.com\httpdocs\home-cooking\EmailInvite.aspx.cs Line: 495
Error For youtube video uploading (using ClientLogin):
Invalid credentials
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: Google.GData.Client.InvalidCredentialsException: Invalid credentials
Source Error:
Line 71: // try
Line 72: // {
Line 73: FormUploadToken _token = request.CreateFormUploadToken(newVideo);
Line 74:
Line 75: actionURL.Value = _token.Url + "?nexturl=" + Server.UrlPathEncode(Request.Url.ToString()+"?uuc=");
Source File: d:\inetpub\vhosts\e-koren.com\httpdocs\home-cooking\youtubeUpload.aspx.cs Line: 73
Anyone knows what could it be?
Thanks,
Asaf

I managed to slove it eventually:
as for the first error (authsub and google contacts) - I changed the URI from "http" to "https":
// V1
GAuthSubRequestFactory authFactory = new GAuthSubRequestFactory("cp",gn.ytApplicationName);
authFactory.Token = (String)Session["token"];
ContactsService service = new ContactsService(authFactory.ApplicationName);
service.RequestFactory = authFactory;
ContactsQuery query = new ContactsQuery(ContactsQuery.CreateContactsUri("default"));
// VERY IMPORTANT! adding HTTPS resolves google's bug (401 error)
query.Uri = new Uri("https://www.google.com/m8/feeds/contacts/default/full");
ContactsFeed feed = service.Query(query);
about the 2nd error (ClientLogin) - appearantly google have tightened the security measures around this kind of method - they send a warning email to the user that I wanted to log in through - and only if he follows several complex steps they authorize access to his videos.
As I found out this is not an error, but a policy, I think I'll just switch to AuthSub there too.
Hope I could help someone else too...
:)

Related

How to authenticate before doing any action with Hieu Le XMLRpc Client

I am testing following Wordpress XML-RPC PHP Client
https://github.com/letrunghieu/wordpress-xmlrpc-client
I have 3 sites where I post remotely, however if the password on one site is wrong it gives Fatal error and stops the PHP execution, I want to catch this error and manage if one stops, it should exit and continue to post on other sites.. below is the error I get
Fatal error: Uncaught XML-RPC error: Incorrect username or password. (Code: 403) thrown in \WordpressClient.php on line 926
Is there anyway I can first authenticate login information and then proceed with the rest of the code, if it fails, it should simply exit the function and proceed with rest of the PHP code..
already explained at the top..

Cannot connect to a localhost SQL server database in UWP

I have created a UWP application for testing purposes in which my purpose is to be able the application to connect to a ASP.NET Web API with a certificate for Indivual User Accounts, I've hosted the db into localhost, after ensuring the connection its correct and everything its ok I have deployed my UWP app, the problem is that when I execute a call to a method inside the Account controller (api/Account), the compiler throws me an exception which is the following:
System.Net.Http.HttpRequestException
Message=An error occurred while sending the request.
Source=System.Net.Http
...
Inner Exception 1:
COMException: The text associated with this error code could not be found.
The certificate authority is invalid or incorrect
I have searched for the problem but there's not a "specific" or "correct" answer I've found, could anyone help me with this issue please?
if code snippets are required, let me know!

Invalid Meter Number and Now Authentication Failed

I am using FedEx (Plugin) in nopCommerce.And fill all the Necessary Details.and got error message (meter number in invalid) but when i change the url from https://wsbeta.fedex.com:443/web-services to https://gateway.fedex.com:443/web-services and now new error occur Authentication Failed. I check all the details
Twice.
And when i check admin-> system ->log
and found the the follow Details. Now I Face the problem with Authentication Failed. If u solve this please tell me how.
Log 1:
Log Level : Warning
Short message : Shipping (FedEx). Authentication Failed
Full message:
IP address: 127.0.0.1
Customer:
Page URL:
Referrer URL: /onepagecheckout
Created on: 9/15/2014 12:40:30 PM
Log 2 :
Log Level : Warning
Short message : Resource string (messages.order.product(s).shippingaddress) is not found. Language ID = 1
Full message:
IP address: 127.0.0.1
Customer:
Page URL:
Referrer URL: /onepagecheckout
Created on: 9/15/2014 1:02:52 PM
Thanks
First, make sure that your using your FedEx production credentials (key, password, account, and meter) as your test credentials will not work in their production environment.
Second, try using 'https://ws.fedex.com:443/web-services' instead of 'https://gateway.fedex.com:443/web-services'. From my understanding the 'gateway' endpoint is older.
Third, if your using the FedEx provided WSDL, you'll have to open and modify the endpoint binding located at the bottom on the WSDL file.

Detailed error messages ASP - Showing 2 lines

I am trying to debug an ASP Intranet application,
I have turned on detailed error messages and turned off Friendly error messages in IE but my error message only shows:
error '80004005'
/login.asp, line 15
If I debug an asp.net application I get a block of information including where the error occurred for example, "MySQL Failed to connect...
Is there any way to show more detailed error messages,
I have ran through Detailed 500 error message, ASP + IIS 7.5
But I still only get the basic error message which shows me there is a connection issue 'Somewhere'
Error '80004005' means that a database connection failed. Is your connection string correct, is your database running, (or if you're using Access, does your IUSR account have the correct permissions on the mdb file)?
(Comment posted as question as suggested)

IIS7 won't display ASP.Net error message or stack trace

I'm trying to debug an error in an ASP.Net 3.5 application. We recently moved the application from IIS6 to 7. In IIS6, code like this:
Throw new Exception("My message")
Would display a page giving the error message, nearby lines of code, and a stack trace (using "debug" compilation mode and no custom errors).
In IIS7, the "detailed" error message gives only the module and error code:
HTTP Error 500.0 - Internal Server Error
The page cannot be displayed because an internal server error has occurred.
Detailed Error Information
Module global.asax
Notification BeginRequest
Handler StaticFile
Error Code 0x00000000
Requested URL [My URL]
Physical Path [My Path]
Logon Method Not yet determined
Logon User Not yet determined
Failed Request Tracing Log Directory [My Directory]
I even set up Failed Request Tracing, which purports to give a stack trace but which still doesn't give me any line numbers or error messages, only the module name and HTTP status.
No. 111.
Severity Warning
Event -MODULE_SET_RESPONSE_ERROR_STATUS
ModuleName global.asax
Notification 1
HttpStatus 500
HttpReason Internal Server Error
HttpSubStatus 0
ErrorCode 0
ConfigExceptionInfo
Notification BEGIN_REQUEST
ErrorCode The operation completed successfully. (0x0)
How can I get the information I was getting in IIS6? I already know the error is in global.asax, I need a line number and a specific error message.
Also, I'm not sure if this is related but the site is precompiled and aspnet_compiler.exe apparently sets the web.config "debug" switch to false when it compiles (even with the "-d" option). My machine.config has no "deployment" tag. I just set "debug" back to true and recycle after compiling, which I assume would put the site back in debug mode, right?
There is a setting in the error page config that tells IIS the level of detail information to show for local and remote requests. You might want to verify this is configured correctly. To access this setting launch the Internet Information Services Manager and go to
Site Home\Error Pages\Edit Feature Settings
Make sure you disable this setting in production

Resources