forbidden call to /tokens api - box-api

I'm trying the new "private beta" feature "Tokens" (http://developers.box.com/docs/#tokens) of box 2.0 using an API key, which I think has private beta access.
But I get the following response:
{
"type":"error",
"status":403,
"code":"forbidden",
"help_url":"http:\/\/developers.box.com\/docs\/#errors",
"message":"Forbidden",
"request_id":"10957639134febfbf1f1477"
}
Look like my obtained API key doesn't have access to the "Tokens" api. Is there any way to verify it? What do you guys think?

Per the note in the documentation, you'll need to contact us at apiATboxDOTcom in order to have this enabled.

Related

How does pass_thread_control work in Facebook Handover Protocol?

I'm trying to test the pass_thread_control function on Facebook Messenger, to have my Dialogflow bot direct ongoing conversation to a human operator. So far I'm stuck at even trying to get a "success" code in Graph API Explorer. I have reviewed Facebook's documentation ( https://developers.facebook.com/docs/messenger-platform/reference/handover-protocol/pass-thread-control/ ), carefully looked through different threads here or elsewhere. I have:
Subscribed my Facebook Page to receive messaging_handovers.
Set the Dialogflow chatbot app as the Primary Receiver.
Set the Page Inbox as Secondary Receiver.
...And I keep on getting various errors. For example, I try this request in Graph API explorer:
POST to https://graph.facebook.com/v5.0/me/pass_thread_control
with params:
{
"recipient": {
"id": "myPageID"
},
"target_app_id": "263902037430900"
}
{
"error": {
"message": "Unsupported post request. Object with ID 'me' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100,
"error_subcode": 33,
"fbtrace_id": "AipGijCLKQOwOl6L792ZEgG"
}
}
Maybe the issue is the recipient PSID? This is the only parameter I have no idea where to get. What is the page scoped app-id? How do I get it?
Or maybe I missed some permissions...?
Any help getting me unstuck much appreciated...
Okay, I actually managed to figure it out.
First and foremost - I discovered the Page I was trying to pass the thread control to wasn't linked to my Facebook Business account and the chatbot app was. I added the page in Facebook Business Manager so that it's linked to the same business account as the chatbot app. NOTE: I am not sure that this is a prereq for everyone, so take caution. It might not be required in all scenarios.
To retrieve the Page PSID, which can then be used in the 'recipient' param of the POST request to pass_thread_control, Sent a GET request using Graph API Explorer as shown here: https://developers.facebook.com/docs/facebook-login/connecting-accounts#examples
Even though the example request does not contain the appsecret_proof param, I used it and haven't tested the request without it. A very simple way of generating appsecret_proof using PHP is shown here: https://developers.facebook.com/docs/graph-api/securing-requests#generate-proof
Then when providing the PSID obtained using method shown in point 2., I got "success:true" while testing the pass_thread_control, which did pass the thread control to Secondary Receiver = Page Inbox. Yaaay! 😊
All of the above is described also in this thread, which helped me figure it out, so credit to Sunil: Is Facebook Messenger PSID PageScope constant for User

Postman HERE API Error on Setup

I'm having an issue setting up to the HERE API using Postman following these two guides: 1, 2.
Anyways, I've loaded the Postman collection, set the global environment and placed in my app-id and app-code (Freemium account) but I still get the following error when trying to get the access token:
{
"msg": "app_id or app_code is wrong",
"kind": "datalens#error",
"code": 402
}
Does anyone have any experience with getting through this? I've tried a million different little variations but I still get the same error. Any help is vastly appreciated. Thanks
Unfortunately the Geovisualization REST API is the only API on the portal that's currently not part of the Freemium plan. I apologize for the unclear error message and will look into improving this. To gain access please contact us through the portal.

Getting all application extensions, and just applicaiton extensions for an object from MS Graph

Assume I know the extension names I am looking for I could get a users extensions like so:
GET https://graph.microsoft.com/v1.0/users/{{OBJECT_ID}}?$select=extension_{{APP_ID_WITHOUT_GUIDS}}_SomeId,extension_{{APP_ID_WITHOUT_GUIDS}}_SomeValue
Or I could get the attributes from his member groups like so:
GET https://graph.microsoft.com/v1.0/users/{{OBJECT_ID}}/memberOf?$select=extension_{{APP_ID_WITHOUT_GUIDS}}_SomeId,extension_{{APP_ID_WITHOUT_GUIDS}}_SomeValue
However, what If I wanted to see all extension the token had paticular access to. $select=extension_* does not work I get the following:
{
"error": {
"code": "BadRequest",
"message": "Term 'extension_*' is not valid in a $select or $expand expression.",
"innerError": {
"request-id": "3b4e14d6-3bbc-429b-8c45-b0fea629f4a6",
"date": "2018-04-06T13:35:40"
}
}
}
Is there syntax to make this possible?
No, this isn't possible with Microsoft Graph (using v1 Directory Schema Extensions). With Azure AD Graph API there is a function - getAvailableExtensionProperties - that should return all the available v1 directory schema extensions available in the tenant; this doesn't exist in Microsoft Graph. If you use Microsoft Graph schema extensions, you can query /schemaExtensions to find all public schema extension definitions available for use in any tenant (although your app also needs to have been granted access to the underlying extended object - like user).
Hope this helps,

Google Contacts API (contacts.readonly)

I'm developing a C Library to access my google contacts information to be used in a C command line app (for personal use only).
I'm trying to authenticate with the scope: https://www.googleapis.com/auth/contacts.readonly but the answer is always "invalid_scope".
Any suggestion?
EDIT:
Some more information about my problem.
I created a Google Project and enabled some APIs (Contacts API and People API).
I'm using curl and a JSON library to communicate with Google APIs.
The code that I'm using is:
#define GOOGLE_AUTH_URL "https://accounts.google.com/o/oauth2/device/code"
#define GOOGLE_AUTH_POST "client_id="GOOGLE_AUTH_CLIENT_ID"&scope=email profile https://www.googleapis.com/auth/contacts.readonly"
int main(void) {
char * res = handle_url(GOOGLE_AUTH_URL,GOOGLE_AUTH_POST); // use curl to make a POST
if (res==NULL) {
Report("Error");
return -1;
}
cJSON *obj = cJSON_Parse(res);
printf("Result=%s\n",cJSON_Print(obj));
return 0;
}
... and the result is:
Result={
"error": "invalid_scope"
}
If I change the define to:
#define GOOGLE_AUTH_POST "client_id="GOOGLE_AUTH_CLIENT_ID"&scope=email profile https://www.googleapis.com/auth/contacts"
the result is:
Result={
"verification_url": "https://www.google.com/device",
"expires_in": 1800,
"interval": 5,
"device_code": "AH-1Ng2lAE01qw5HFlGQqT02q7dtmAE6WmKJ_FkH0mO4enJMybvCvRzXnazvyUm22-sJR51ZtKkIJjOT-QhO0PJBUZpCdLrOEw",
"user_code": "JNXW-WQPJ"
}
Google wants developers to explicitly enable the APIs that they intend to use. This limits the potential damage if your OAuth credentials are compromised. So the Contacts API may need to be enabled for your project.
Visit this link and select the project from the page header to confirm that the API is enabled for your project: https://console.developers.google.com/apis/api/contacts.googleapis.com/overview
As Graeme said, first you need to enable the API. Second, in your OAuth client setting page (Credential -> OAuth 2.0 Client IDs section), you also need to explicitly add this scope https://www.googleapis.com/auth/contacts.readonly.
I guess the reason why you can use this scope (https://www.googleapis.com/auth/contacts) is because you already added this scope on the OAuth client setting page.

SendBird GET Request Api for retrieve previous messages not working properly

Im using SendBird platform API to create chat in my website,
when i try to retrieve the previously send messages in a channel using below API:
https://api.sendbird.com/v3/{channel_type}/{channel_url}/messages
METHOD : GET
Request: ?message_ts=long(Required)&prev_limit=int(Optional, default: 15, 0~200)&next_limit=int(Optional, default: 15, 0~200)&include=boolean(Optional, default: true)&reverse=boolean(Optional, default: false)&custom_type=string(Optional)&message_type=string(Optional)&sender_id=string(Optional)
after passing value to above request,im getting an error saying
{
"message": "Not authorized. Get messages function can be called only from Park or Enterprise plan.",
"code": 400108,
"error": true
}
can some one please help me with this
Thanks
Nithin
The Message Retrieval API which you are calling is a premium feature as you can see in Senbird's Pricing Page.
You will have to contact Sendbird and upgrade to their premium plan in order to retrieve message and successfully call the endpoint.
You can retrieve messages in SDKs (available for JavaScript too).
In Android call this method,
mChannel.getPreviousMessagesByTimestamp()
where mChannel is an object of type GroupChannel(OpenChannel also allowed).
And as far as I know, it is ok to retrieve messages like that.
For Javascript
refer to this link