Get the currently allowed scopes of an OAuth user - github

I would like to know how to get a currently allowed scopes for a user signed in with GitHub.
Currently, I am maintaining a local copy of the authorized scopes, but I think it might be better to get the real data to avoid possible inconsistencies.
Any suggestions?

You can list all your personal access token or if you know the current ID of the access token you're looking for you can retrieve it individually.
This is the sample response for a single token. You are interested in the scopes element:
{
"id": 1,
"url": "https://api.github.com/authorizations/1",
"scopes": [
"public_repo"
],
"token": "",
"token_last_eight": "12345678",
"hashed_token": "25f94a2a5c7fbaf499c665bc73d67c1c87e496da8985131633ee0a95819db2e8",
"app": {
"url": "http://my-github-app.com",
"name": "my github app",
"client_id": "abcde12345fghij67890"
},
"note": "optional note",
"note_url": "http://optional/note/url",
"updated_at": "2011-09-06T20:39:23Z",
"created_at": "2011-09-06T17:26:27Z",
"fingerprint": "jklmnop12345678"
}

Related

How to get an access token to pull comment author data into Integromat for posts in a Facebook group I own

I am trying to set-up a scenario in Integromat that reads comments on a facebook posts in a private group I own. Currently integromat can only pull comment level data, and not comment author data. However, from what I've read when integromat has been given a User Access Token from a facebook user that is an admin of the group then they can read comment author data.
Can I simply create a plain app, make it live, install it on the group, and then provide integromat my client access token from that app in order for them to be able to pull comment author data?
It's looking like the "watch comments" module in Integromat doesn't return author data. It appears what you're trying to do is currently not possible with the "watch comments" module. Here's some data a scenario I ran returned:
{
"id": "",
"object": {},
"parent": {},
"message": "",
"attachment": {
"description": "",
"type": "",
"title": "",
"target": {
"id": "",
"url": ""
},
"url": "",
"media": {
"image": {
"height": ,
"src": "",
"width":
}
}
},
"like_count": ,
"created_time": "",
"comment_count":
}

Zendesk API - Creating a ticket gives wrong ticket status

Zendesk API documentation states that when creating a ticket through the API, the status field can be set to "new" (https://developer.zendesk.com/rest_api/docs/core/tickets#create-ticket), yet if I call the API with the following command specifying a value for status, it creates a token yet still sets status to be the default value of open:
curl -u <username>/token:<api_token> https://<subdomain>.zendesk.com/api/v2/tickets.json -d '{"ticket": {"subject":"test subject", "comment": { "body": "test body" }, "status": "new" } }' -H "Content-Type: application/json" -v POST
The relevant part of the response body is:
"ticket": {
"url": "https://<subdomain>.zendesk.com/api/v2/tickets/60.json",
"id": 60,
"external_id": null,
"via": {
"channel": "api",
"source": {
"from": {},
"to": {},
"rel": null
}
},
"created_at": "2016-05-05T13:30:01Z",
"updated_at": "2016-05-05T13:30:01Z",
"type": null,
"subject": "test subject",
"raw_subject": "test subject",
"description": "test body",
"priority": null,
"status": "open",
"recipient": null,
"requester_id": 5917202647,
"submitter_id": 5917202647,
"assignee_id": 5917202647,
"organization_id": 3740197137,
"group_id": 28473587,
"collaborator_ids": [],
"forum_topic_id": null,
"problem_id": null,
"has_incidents": false,
"due_at": null,
"tags": [],
"custom_fields": [],
"satisfaction_rating": null,
"sharing_agreement_ids": [],
"fields": [],
"brand_id": 1090897,
"allow_channelback": false
}
Am I doing something wrong?
So it turns out that if you assign a ticket to a group with only one member/agent, the ticket automatically gets assigned to that lone agent. As such, any ticket that's already assigned to a specific agent, is automatically set to open instead of new.
Because I was using a test subdomain, I was the only agent and so it was auto-updating the status from "new" to "open".
Hmm, I made the same API call (with my creds/subdomain) and it worked, setting the "status" to any option I choose (new, pending, solved).
Have you confirmed that all your credentials and subdomain are correctly inputted? Also, check the API settings in your Zendesk account. Try creating a new token and Save the settings.
If the API token still doesn't work, maybe try authenticating with password or making the request by means other than curl.

How To User Fetch Friends Data Using Graph API

What i Need:
i need to fetch my friends like email ,id , name .
i have tried using https://developers.facebook.com/tools/explorer/1456/?method=GET&path=me&version=v2.1.
url is like graph.facebook.com/v2.1/me .
data
{
"id": "77",
"email": "af55#gmail.com",
"first_name": "Mo",
"gender": "male",
"interested_in": [
"female"
],
"last_name": "f",
"link": "https://www.facebook.com/app_scoped_user_id/777/",
"locale": "en_GB",
"name": "singh",
"timezone": 5.5,
"updated_time": "2014-08-18T05:34:55+0000",
"verified": true
}
but making call graph.facebook.com/v2.1/user
Error
{
"error": {
"message": "(#803) Cannot query users by their username (user)",
"type": "OAuthException",
"code": 803
}
}
i have refer the url https://developers.facebook.com/docs/graph-api/reference/v2.1/user.
i have tried to solve by go ->getACEESS TOKEN->check on permissions->email->user_friends.
but still i cannot fetch url through user.
making call with me/friends
{
"data": [
{
"name": "Ashwani Gaur",
"id": "62036"
},
{
"name": "Shobhit Puri",
"id": "131"
},
{
"name": "Rahul Raman",
"id": "10007"
},
{
"name": "Piyush Agarwal",
"id": "800899"
},
{
"name": "Neeraj Yadav",
"id": "10000"
}
],
"paging": {
"next": "https://graph.facebook.com/v2.1/777009872366669/friends?limit=5000&offset=5000&__after_id=enc_AeytV0frT0k1mTj0ZfZRTxPsdSP3TVT_Qd-I1Aoc8vA8YseN4Rr8Vg5n6RgECxsd6RXaVNL8fJ0iaI79qEW7K8nw"
},
"summary": {
"total_count": 383
}
}
i need id, name, email, friend personal_info.
Since April 2014 (v2.0), there are no friend permissions anymore and it´s not possible to get user data from people who don´t use the App. See the changelog for more information: https://developers.facebook.com/docs/apps/changelog
The docs are a bit misleading, you can only use /me to get data of the user who is logged in at the moment.
Update:
By requesting /me/friends, you get all the friends using the App. But as i said in my first sentence, there are no friend permissions anymore. You will only get ID and name of your friends, nothing else. Even if your friend authorized your App, you can ONLY get more data with his own session and by calling /me. The email permission only gives you access to the email of the user who is logged in, not access to the emails of all his friends, of course.
You can only store the email after authorizing a user, that is the only way for other users to get the email of his friends - at least the ones who authorized your App too.

Sharing Spotify link to Facebook and retrieving the link from graph api?

I have posted a link to a spotify track on my facebook account - something like this:
http://open.spotify.com/track/0aXxt38KBHHSmwNsHtIonU
Facebook appears to pick up the link (I get the track image and other data appearing in my feed)
But when I make a request to it via /me/feed in the graph api, there's no link or data relating to the track itself. All I get back is object that looks like this:
..{
"id": "{{some_id}}",
"from": {
"id": "{{my_id}}",
"name": "Si Davies"
},
"icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/y0/r/nAApRnfWfNW.gif",
"actions": [
{
"name": "Comment",
"link": "{{link to the post}}"
},
{
"name": "Like",
"link": "{{link to the post}}"
}
],
"privacy": {
"description": "Public",
"value": "EVERYONE",
"friends": "",
"networks": "",
"allow": "",
"deny": ""
},
"type": "link",
"status_type": "shared_story",
"created_time": "2014-06-17T02:17:06+0000",
"updated_time": "2014-06-17T02:17:06+0000"
}...
Which isn't much use to me - I've tried specifying a link field with something like me/feed?fields=link and also mucked around granting various permissions with little or no effect.. how can I see what spotify track was added to my feed from the graph api?
Spotify seems to use the global music.listens Facebook OpenGraph action. Have a look at https://developers.facebook.com/docs/opengraph/music/
You should be able to retrieve your data by issuing
GET /me/music.listens
according to the docs at https://developers.facebook.com/docs/reference/opengraph/action-type/music.listens#read Remember to grant the user_actions.music permission to be able to read the data (https://developers.facebook.com/docs/facebook-login/permissions/v2.0#reference-opengraph)

Facebook Graph Search Error while searching "Event"

This is embarrassing, but I am at my wits end. While performing a very simple search for "Events" using fb Graph Search, I get the following error:
{
"error": {
"message": "(#200) Must have a valid access_token to access this endpoint",
"type": "OAuthException",
"code": 200
}}
This is the code I execute:
https://graph.facebook.com/search?q=conference&type=event&limit=1&access_token=XXXXXXXXXX|XXXXXXXXXX
It works JUST FINE for any other type of search - with the same access token for example:
https://graph.facebook.com/search?q=conference&type=place&limit=1&access_token=XXXXXXXXXX|XXXXXXXXXX
I get the following result:
{
"data": [
{
"category": "Local business",
"category_list": [
{
"id": "164243073639257",
"name": "Hotel"
}
],
"location": {
"street": "Langelaan 3",
"city": "Noordwijk",
"state": "",
"country": "Netherlands",
"zip": "2211XT",
"latitude": 52.251963727407,
"longitude": 4.4722281054509
},
"name": "NH Conference Centre Leeuwenhorst",
"id": "165032770219308"
}
],
"paging": {
"next": "https://graph.facebook.com/search?limit=1&type=place&access_token=XXXXXXXX|XXXXXXXXX&offset=1&__after_id=165032770219308"
}
}
At this point, I am out of ideas.
Facebook recently changed things in their API, Search was one of those things. You can only do this kind of search on Places and Pages now. To search events, you need an app access token. See this blog post: https://developers.facebook.com/blog/post/2013/04/03/platform-updates--operation-developer-love/
Fixed! I am now able to search for events by using an App Token generated using the new api. Thank everyone for your help