Google Calendar API key is not working - zend-framework

So accessing from here: https://console.developers.google.com/project
In my project, I just enabled the Calendar API.
Now I am trying to do the following: (my key hidden for obvious reasons)
$client = new Zend_Http_Client('https://www.googleapis.com/calendar/v3/calendars/en.usa#holiday#group.v.calendar.google.com/events');
$client->setParameterGet(array(
'key' => '########################',
));
$feed = $client->request()->getBody();
echo "<pre>";
print_r($feed);
exit;
But doing that gives me the following error:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
What am I doing wrong? I am using a Server API Key.

A few days ago I had similar problem. Check your calendar ID in www.google.com/calendar/ -> my calendar -> calendar settings and calendar address. Id should contain letters and numbers, not email address.

I figured it out. The calendar ID must be urlencoded.

Related

how to setup “Get started” button in facebook messenger bot

I m trying to use postman
link:https://graph.facebook.com/v6.0/me/messages?access_token=my_token
{
"get_started":{
"payload": "Hi, I am bot"
}
}
in raw JSON body
but getting this response
{
"error": {
"message": "(#100) Tried accessing nonexisting field (messages) on node type (Page)",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "AtFh2_fJ2sxkeU8k-2aNJGl"
}
}
Here is the little rundown how to put get started button , I hope its help:
Using postman:
Start by changing the type by choosing a POST request: (one of the
problems that solve my issue thanks to #misorude
Define a Post request to this URL:
https://graph.facebook.com/v6.0/me/messenger_profile?access_token=<PAGE_ACCESS_TOKEN>
As #misorude notice my another problem check endpoint from here https://developers.facebook.com/docs/messenger-platform/reference/messenger-profile-api
In the BODY section:
.
Paste this code:
{
"get_started":{
"payload": "Hi, I am bot"
}
}
P.S.
Thank you again

I am using ngOpenFB on an ionic app, but I dont manage to get user's email

Login seems to go ok, with the email permission,
however when doing:
var deferred = $q.defer();
$openFB.api({
path: '/me/email'
}).then(function( res ) {
deferred.resolve(res);
//angular.extend(me, {picture: res.data.url});
}).catch(function(err){
console.log(err);
deferred.reject(err);
});
I get an error wrong path.
Ben
/me/email is not a valid endpoint. This is how you get the email of a user: /me?fields=email
The error (from the API Explorer):
{
"error": {
"message": "Unknown path components: /email",
"type": "OAuthException",
"code": 2500,
"fbtrace_id": "FBdZx0Yntxz"
}
}

can't exchange token manually v2.7

I'm using Loopback and
I'm trying to user auth for graph api without javascript sdk or passport
I got the code successfully however I can't exchange it with access token
I followed this guide https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/#confirm
my get request is https://graph.facebook.com/v2.7/dialog/oauth?code={xxxx}&client_secret={xxxx}&client_id={xxx}&redirect_uri={myURL}
myURL is the one used to get the code but not be used again if I understand
If I understand correctly I should it the access_token in the body of the response instead I get this error
{
"error": {
"message": "Unknown path components: /oauth",
"type": "OAuthException",
"code": 2500,
"fbtrace_id": "HXe+214tGpW"
}
}
It looks like a bug in the docs. The first call is to www.facebook.com in a browser.
See here for an example client https://github.com/yschimke/oksocial/blob/master/src/main/java/com/baulsupp/oksocial/services/facebook/FacebookAuthFlow.java
The second should be to something like https://graph.facebook.com/v2.7/oauth/access_token
$response = $fb->sendRequest(
'GET',
'/oauth/access_token',
[
'client_id' => $config['client_id'],
'client_secret' => $config['client_secret'],
'grant_type' => 'fb_exchange_token',
'fb_exchange_token' => $short_token
],
$short_token,
null,
'v2.7');

Facebook graph api - Cannot create offers

I am using the facebook graph api to programmatically create offers on a page, of which the user is an admin of.
I am sure the user is an admin of that page, still I am getting an error to check my admin permission levels (Error below). Any idea why? Any help is appreciated.
If it is of any help, I have added the following scope to my requests: {scope: 'manage_pages,publish_pages'}
{
"error": {
"message": "Invalid parameter",
"type": "OAuthException",
"code": 100,
"error_subcode": 1528104,
"is_transient": false,
"error_user_title": "Check Your Admin Permission Level",
"error_user_msg": "Only some admins of your Page are able to create and edit offers. Talk to the person responsible for your Page about your admin permission level.",
"fbtrace_id": "FgBVmH5BTW0"
}
}
A snapshot of my code is as follows:
accessToken = req.session.access_token;
FB.setAccessToken(accessToken);
FB.api("page-name", {fields: "access_token,id"}, function (res) {
var pageId = res.id;
var pageAccessToken = res.access_token;
FB.setAccessToken(pageAccessToken);
FB.api(pageId + "/offers", 'post', {
title: "Test title",
expiration_time: 'some datetime',
message: "Test offer 1"
}, function (res2) {
resp.send(res2);
});

Unable to publish custom story with mention tagging

My app was doing well yesterday and posting custom stories with mention tagging but from today its not working and telling me : -
Received Facebook error response of type OAuthException: Unknown path components: /mynamespace:customaction
Error code : 2500
{
"error": {
"message": "Unknown path components: /namespace:customaction",
"type": "OAuthException",
"code": 2500
}
}
$response = $facebook->api(
'me/mynamespace:customaction',
'POST',
array(
'treat' => "http://www.mywebsite.com/12321425125"
)
);
I have not changed any configurations or anything and it has stopped working all of a sudden. Please help me identify the issue - maybe there is an issue at Facebook end.