How to Define which Calendar to Connect to using Google Calendar API v3 Service - google-api

I am trying to list all the events in a certain public calendar in a nicely formatted manner on my web page without having a general/public visitor to my web site login or authenticate in any way. I have been doing this since December 2010 using v1 and the Zend Framework. On November 17, 2014 Google deprecated v1 and v2 and now my web page is broken.
Here is what I've done so far:
created a project in the Google Developer's Console
turned on Calendar API
installed PHP Client Library on my server from GitHub (yesterday - release 1.1.1)
ensured JSON PHP Extension is installed on my server
created OAuth 2.0 credentials
created Public API Access key
ensured my calendars are still publicly viewable (they have been since December 2010)
Here is my code snippet:
require_once 'autoload.php'; // 2014-11-24 part of /usr/local/lib/php/google-api-php-client
$client = new Google_Client();
$client->setApplicationName("One_of_my_Calendars");
$client->setDeveloperKey("MY-PUBLIC-API-ACCESS-KEY"); // 2014-11-24 my Public API Access Key
$service = new Google_Service_Calendar($client);
$results = $service->events->listEvents('primary');
Here is the error message I am getting:
Fatal error: Uncaught exception 'Google_Service_Exception' with message 'Error calling GET https://www.googleapis.com/calendar/v3/calendars/primary/events?key=MY-PUBLIC-API-ACCESS-KEY: (403) Access Not Configured. The API is not enabled for your project, or there is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your configuration.' in /usr/local/lib/php/google-api-php-client/src/Google/Http/REST.php:76 Stack trace: #0 /usr/local/lib/php/google-api-php-client/src/Google/Http/REST.php(41): Google_Http_REST::decodeHttpResponse(Object(Google_Http_Request)) #1 /usr/local/lib/php/google-api-php-client/src/Google/Client.php(548): Google_Http_REST::execute(Object(Google_Client), Object(Google_Http_Request)) #2 /usr/local/lib/php/google-api-php-client/src/Google/Service/Resource.php(190): Google_Client->execute(Object(Google_Http_Request)) #3 /usr/local/lib/php/google-api-php-client/src/Google/Servi in /usr/local/lib/php/google-api-php-client/src/Google/Http/REST.php on line 76
Screen Shots:
https://drive.google.com/file/d/0Bytqhoir_Tt5ODRaNzRvS2FZRWs/view?usp=sharing
https://drive.google.com/file/d/0Bytqhoir_Tt5MzlqLWF2Q3M2bUk/view?usp=sharing

Assuming you are accessing public calendars (so no need for Oauth2), there are still two issues:
Issue no.1 you need to have a working API key from a project which has Calendar API enabled in the developer console.
Issue no.2 is your usage of the keyword "primary" without being authenticated. Replace it with the email address of the calendar that you want to access.

Related

Unable to perform browser authentication in 3DSecure Flow

We are using Global Payments Java SDK to implement 3DSecure. Our web application first calls check-version API on the backend. And our backend use checkEnrollment function of Secure3dService class in Java SDK to check the status of the card. If the card is enrolled, our backend sends the server transaction id (received from Global Payments) back to our web client.
Now, in the second step, our web client gathers all the customer/browser information and calls authentication API on the backend. The backend passes all the mandatory information to initiateAuthentication method of Secure3dService in Java SDK. But the SDK throws 400 error.
We are not able to figure out why we are getting 400 error back.
#update
If we call the checkEnrollment method of Java SDK just before calling initiateAuthentication method of Java SDK, everything works and we get back a successful response with the same request. But we do not want to do that. Because we want to use the old server transaction id for all the subsequent calls instead of generating a new one.
What is the fix of this issue?

Is there an issue with Bot Framework Virtual Assistant template when Direct Line App Service Extension is enabled

I have Azure Bot deployed with Virtual Assistant Template, which was working fine (And still working in Portal's Test In Web Chat feature) until I enabled Direct Line App Service Extension.
Primary objective to enable DL App Service extension is to isolate bot access and secure app service.
I have followed MS documentation https://learn.microsoft.com/en-us/azure/bot-service/bot-service-channel-directline-extension-net-bot?view=azure-bot-service-4.0 and ensured every step is configured correctly.
Primary step to make sure DL app service is working correctly is to check if https://xxx.azurewebsites.net/api/messages or https://xxx.azurewebsites.net/.bot/ url return correct json result f.x: {"v":"123","k":true,"ib":true,"ob":true,"initialized":true}
But instead i am getting Error Response 400 Bad Request and error message appeared in browser is : "Upgrade to WebSocket is required."
I couldn't even reach to a step where troubleshooting guide mentioned here : https://learn.microsoft.com/en-us/azure/bot-service/bot-service-channel-directline-extension-net-bot?view=azure-bot-service-4.0#troubleshooting could help to resolve.
As i said earlier Bot is still working and the url : https://xxx.azurewebsites.net loads site correctly , can be seen in below
Any help is appreciated
These are the changes I have done and it worked:
Refer Repo With sample code:
https://github.com/SSanjeevi/VirtualAssistantDirectlineExtn
Wrote detailed here.
Project file:
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
<NoWarn>NU1701</NoWarn>
<Version>1.0.3</Version>
BotController.cs
private readonly IBotFrameworkHttpAdapter adapter;
public BotController(IBotFrameworkHttpAdapter httpAdapter, IBot bot)
Startup.cs
Configure Services method:
// Register the Bot Framework Adapter with error handling enabled.
// Note: some classes use the base BotAdapter so we add an extra registration that pulls the same instance.
services.AddSingleton<IBotFrameworkHttpAdapter, DefaultAdapter>();
services.AddSingleton<BotAdapter>(sp => sp.GetService<BotFrameworkHttpAdapter>());
// Configure channel provider
Configure method:
using Microsoft.Bot.Builder.Integration.AspNet.Core;
app.UseHsts();
app.UseCors(x => x.AllowAnyOrigin()
.AllowAnyHeader()
.AllowAnyMethod());
// Allow the bot to use named pipes.
app.UseNamedPipes(System.Environment.GetEnvironmentVariable("APPSETTING_WEBSITE_SITE_NAME") + ".directline");
Webchat:
let directLineConnection = await window.WebChat.createDirectLineAppServiceExtension({
domain: domainUrl,
token
});
The attached repo code also contains serilog implementation to have logging in log stream in app service where you can see the error logs if you face any issues.
Follow this article and implement serilog in bot api and deploy .
https://www.lkgforit.com/2022/10/troubleshooting-by-writing-logs-at_15.html

Setup Web Authenticator in Xamarin Essentials for local Android development

I am trying to setup development environment to integrate Google sign-in on Android using Web Authenticator in Xamarin Essentials.
In the Web API project, same AuthController is included described in this article. It is running on https://localhost:44311/api
To call the API from emulator, API url is referenced as https://10.0.2.2:43411/api as described in this article.
Now, I am able to call the API url using await WebAuthenticator.AuthenticateAsync(apiUrl, callbackUrl)
But, when API tries to invoke Google authentication via await Request.HttpContext.ChallengeAsync(scheme);, below error is returned from Google.
Error 400: invalid_request, device-id and device-name are required for
the private IP: https://10.0.2.2:4311/signin-google
As I understand, it is expecting request originated from the server instead of IP address like https://<servername>
Whole situation comes down to be able to access the webservice using name (or localhost) to be used in both emulator and Google redirect uri.

Houndify: Web SDK Sample: signed token rejected

I've been away from coding for a few years so excuse the simple nature of this question. I've downloaded the Houndify web sdk and followed instructions to get it running on my local web server (localhost). When running it I get the authentication error "signed token rejected". I've updated the config.json and index.html with my client ID and Key. Any ideas?
E W
Can you check:
if you have activated your account by clicking the link in the email
test the request from the API console from the Client dashboard page
I have had the same error and realized that my account was not activated.

Google checkout integration with magento

I'm trying to add Google Checkout to my magento 1.7.0.0 shop. I've traced the issue and it seems to fail during posting to google's server because when I try to read the response it's false.
The error I get is: Google Checkout: Invalid response from Google Checkout server
I'm using magento 1.7, google sandbox with sandbox credentials, verified bank account, unchecked digitally signed carts, but am using a self-signed certificate on my development machine, and API version 2.2.
The issue is happening in app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Abstract.php on lines 174, 175
$http = new Varien_Http_Adapter_Curl();
$http->write('POST', $url, '1.1', $headers, $xml);
$response = $http->read();
Not a PHP dev ~
Is this a sandbox server to server (Shopping Cart) POST? Check:
that you are using sandbox credentials in your headers;
that you are posting to a sandbox url for the xml you are sending
Note - unchecking "digital cart" only means your account will also accept HTML API cart POSTs, but it doesn't mean you can send XML without a digital signature if doing direct FORM post to Google - re: in XML API, you have 2 options to send XML data:
Direct HTML FORM POST to Google (must include signature), or;
Server to Server POST to Google (must use Basic Auth credentials)
You can also check your sandbox Integration Console for detailed error messages:
Tools -> Integration Console
Hth...
There was a problem with it being a local environment. The issue was either with Google not being able to communicate or with my tld ending in .dev. Possibly Google rejected the request for that reason.

Resources