Github graphql query based on username in the organization - github

Is there any github graph query which fetches repos based on the username in organization.
Example:
Let's say in the org testOrg, we have around 1000 plus users and each user contributed to multiple repos.
I need the query to fetch all the repos that a particular user contributed.
Here we are not using the user's Personal Access Token in Authorization. We registered an app at org level and we are using the that App Token in Authorization.
So how to query the repos that a particular user contributed, based on user's github userid and using app token as authorization toke

Related

GitHub App won't add any other authorities besides "user" to token

I am trying to create a GitHub App that would allow any user to query all of their project boards (non-classic boards). When I created the GitHub App, I went to the "Permissions" tab (as outlined here) and added that I want to request read & write access for project boards. My understanding is that when a user authorizes access to the app, they would be authorizing access to their project boards because of this. However, after inspecting the authorities of the token generated from authorizing the app, it only has authorities [ROLE_USER, SCOPE_read:user] , no project read or write role. Am I missing something here/does GitHub prevent GitHub Apps from accessing a user's non-classic boards?

Github Oauth App doesnot show Auth Screen if we have already authorized . But Newly Added Org are not visible via Old AccessToken

Here is my scenario
i have created an Github Oauth App and below are the steps performed
I completed oauth flow via URL https://github.com/login/oauth/authorize client_id=XXXXXXXXXX&scope=repo,read:org
And then i grant the access to existing organisation named firstOrg and i got access_token.
When i use github api using access token from step 1 to get list of organisations . I see firstOrg in the response
Now after some time, i added new organisation under same github account called secondorg .
Issues:
Now when i try to get the list of organisations using the same access token ,i see only firstorg in the response and i don't secondorg in the response
If i try to re-authorize the oauth flow via same url i.e https://github.com/login/oauth/authorize client_id=XXXXXXXXXX&scope=repo,read:org . I don't get the authorize screen to grant access to secondorg ,instead it bypassed it and straight away returns the auth code.
As of now , Only work around i am seeing is Go to -> Oauth App -> Revoke token and then perform Oauth step again , where i can grant access to both organisations . Then i can see two organisations in the response using new access_token
API I am using to get the list of orgs is https://api.github.com/user/orgs
QUESTION
Is there any way to get the list of updated organisation using same access token ?
Is there any way to forcefully get the OAuth Authorization Screen instead of github automatically bypassing the auth screen ?

How does facebook token works?

I want to write a process which downloads data about my ads.
Basically this is the code:
https://github.com/airflow-plugins/facebook_ads_plugin/blob/master/hooks/facebook_ads_hook.py
It construct a URI as:
https://graph.facebook.com/v{api_version}/act_{account_id}/insights?{payload}
Where payload contains the access_token, breakdowns, fields etc..
Now, I passed over the facebook dev guide https://developers.facebook.com/docs/graph-api/using-graph-api/ and it doesn't explain how do I get the account_id and the token.
It always leads to a user account that needs to log-in to facebook and then process the request.
I want to build a process that doesn't involve user action. Just download logs about my ads.
How can I do that? Where can I get the account_id and the token.
In other systems like google and other they create a json file with credentials that is used for the outh. there doesn't seem to be equivalent with facebook.
For this type of use case, I would create a System User that is permissioned on all your ad accounts, following this guide. That will allow you to generate a token that can used without user login. (You can do the same for your personal facebook account, but that requires you to pass app verification. This can be done without that.)
Then to get the account ids of all the accounts the system user is permissioned on, query the "me/adaccounts" endpoint, using the access token generated for the system user. The docs for that are here. You can use that to get a list of all the account ids.
Alternatively, if you only need one account id, you can get that straight from the facebook ads manager.

VSTS all time integration

I have a web-site with users "site-account".
Users also are registered in VSTS / (project1.visualstudio.com, project2.visualstudio.com, ...) "vsts-account"
I need allow user once link a "site-account" to "vsts-account" (one or multiple)
After link a account i can read / write a Work-Backlog item in any time.
Example, in background read Work-Backlog and send email notification.
I cant understand how i can link and grand access to "vsts-account" from "site-account"
I can create a Extension, that will be installed in VSTS.
Thanks for any links
The simple workflow:
Create a web app with OAuth authorize, refer to this article: ASP.NET web app (OAuth sample)
The user login your web-site with "site-account"
After login, enable the link (e.g. vsts-account), the user can click the link to authorization to the VSTS
Associate the access token and refresh token to that user (store in database)
Using refresh token to get access token if the access token expired
Using access token to get work item in VSTS
More information about OAuth with VSTS, you can refer to Authorize access to REST APIs with OAuth 2.0

How to generate Facebook Marketing API access token to use it in Windows application

I am using Facebook as advertising platform to promote my application on Apple and Google stores. I would like to make windows service which will download daily report(s) about advertising status of my marketing campaign running one Facebook, preferably using 60 day token, or some permanent solution so that token is retrieved when required. I think that i understand everything to do this except how to generate access token to use it with Facebook Graph API. Which token for which Facebook account do I need and how to obtain it?
You'll need a Facebook app and to grant that app the ads_read permission in order to retrieve reports about your advertising efforts via the API (source).
You'll want a long-lived token so that you don't have to re-authenticate very often. The access token documentation details the steps to exchange a short-lived token for a long-lived one.
You may also want to consider managing the app, ad account, and access tokens (via a business system user) with the FB Business Manager.
Create a facebook app.
Go to the Graph API Explorer in Facebook's Tools & Support section.
Pick your app from the drop down.
Hit Get Token > Get User Access Token.
In Select Permissions choose required permissions or select them from extended permissions.
Use the user access token that will be presented to you in the access token form input field.