I am trying to integrate Yammer and Outlook using the Rest API, I can read the emails but I have an error returned when reading data from yammer. The documentation is unclear about it, can they help?
You need to follow one of the authentication flows outlined within a browser window.
Typically you would popup a window with a browser control to do this work and then securely store the OAuth token returned. I recommend working through the flow by hand before writing code to integrate it. It is expected that a user sees and has to agree to an OAuth dialog like the one shown.
You then pass the token on the authorization header like this with your HTTP requests:
Authorization: Bearer TOKEN_HERE
Perfect Brian, but I'm using Graph's endpoint, I'd like to use Outlook and Yammer together.
var authEndpoint = 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize?';
var apiEndpoint = 'https://graph.microsoft.com/api/v2.0';
I would not like to authenticate again, is it possible?
You'd need to add resource=https://www.yammer.com param to the authEndpoint to be able to access yammer data. See this blog post for further details - https://blogs.technet.microsoft.com/israelo/2016/07/05/yammer-apis-and-adal-tokens/
Related
I'm working on a project where I pull in data from social media according to certain queries and analyze them. Currently I'm pulling in Instagram media data.
The only thing I want to do is to input a query and get JSON media/likes/comments.... I read the documentation of their API. I found that I couldn't get an access token without authorizing using my own account in a browser. I know there's gotta be a user, so I assume using my own account is fine. But the problem is that I don't want to get an access token manually from a browser.
Currently I'm hardcoding the access token. It will expire and I have to update it manually every time. I bet there's a better solution. Could someone help me out? Thanks.
class instagramFeed():
CLIENT_ID = "MY-APP-ID"
REDIRECT_URI = "MY-ORGANIZATIONS-URI"
ACCESS_TOKEN = "I MANUALLY GENERATE THIS TOKEN"
query = None
def __init__(self):
None
def get_data(self, query):
response = urllib2.urlopen("https://api.instagram.com/v1/tags/search?q="+query+"&access_token="+self.ACCESS_TOKEN)
It is not possible to get access_token without logging in on Instagram page, thats the whole point of oauth authentication.
You will have to manually get access_token and update, from my experience the Instagram access_token never expires, I have used it for 6 years. Only time you have to get new access_token is if Instagram revokes it because of suspicious activity detected. So as long as you use the API carefully without automating too much back-to back calls, you should be good with the same access_token.
I'm looking at getting some stats out of Google Analytics using the Embed API to display on our site using javascript.
My question is:
Is it possible to display the stats without the user authenticating? I.e. I would like to make some traffic statistics available to anonymous users.
Thanks,
Chris.
This is definitely possible, but you'll have to get the access token yourself (server side, using whatever OAuth 2.0 flow you want).
Once you have a valid access token, you can pass it to the gapi.analytics.auth component and use the Embed API as normal.
Here's some documentation on that:
https://developers.google.com/analytics/devguides/reporting/embed/v1/component-reference#auth
UPDATE: (07/27/2015)
A demo of server-side authorization with the Embed API is now featured on the Google Analytics Demos & Tools site. You should look there to see a working example.
I'm developing an application where each 'business' has its own page (or rather many pages):
For example example.com/business/abc/
So, for the logged in business owners in the system I would like to give a feature 'View page analytics'. It would display how many visits (and maybe a couple of other things) that particular page has had.
Is there a way of doing this using the Google Analytics API with my constraints:
I don't want customers to provide their own UA code
I don't want them to require to have GA account
Customers don't need to have Google email account
I don't want to build the entire frontend and backend myself. I would rather use something existing
I've been researching this topic for hours trying to come up with a solution and can't figure out anything.
Here is what I tried and what problems happened to me:
http://ga-dev-tools.appspot.com/demos/embed-api/
This is basically exactly what I want for my customers to be displayed on my site (like in the examples), except that Embed Api tries to authorize users to their own (owned) google analytics. I want it instead to use my own Google Analytics data (or rather part of it)
The way I thought about limiting data access would be for every one of my customers to create a View in GA, Add filter to that View so only customer pages are listed there, assign User to the view, and use the Embed Api to display data from that View only. There are a couple of problems with that:
To assign User to View we need email address. And this must be either google account email, or account from a project created with Google Developers Console (application).
In other words I can't create (in any way that I know) an account that would be a shield account for my customers to a subset of my GA data that they would be interested in. It must be either a real user or a real application email address.
So what I tried to do is... I created an app in Google Developers Console, Created new OAuth Service Account. Using Ruby code (that in production app would be running on backend) I obtained OAuth token. I added this email of my OAuth service account as a User to the View
I wanted this server side generated oauth token to be used by Embed Api. That would achieve the effect that I generate the token for on my backend and user can use it without having GA user in my GA property. So I changed according to documentation the basic Embed Api example to use
gapi.analytics.auth.authorize({
container: 'auth',
clientid: 'xxx.apps.googleusercontent.com',
serverAuth: {
access_token: 'Server side generated token'
}
});
instead of
gapi.analytics.auth.authorize({
container: 'auth',
clientid: 'xxx.apps.googleusercontent.com',
});
The effects are not quite what I expected. The example doesn't show anymore (I can't see my data) but I can see in Netowrking section in Chrome that it is actually receiving real data from GA. But for unknown reason, nothing is appearing.
What I try to avoid is building a solution in which I need to build server side code that is querying GA for data, providing it to the frontend and then JS is responsible for displaying it. I would rather use Embed API but it seems not to be well suited for the use case where I don't want users to play with their UA data but rather with my own UA data limited to some scope. I would like to have at least the frontend or backend part of the solution solved. The solution doesn't need to be even Google Analytics based. Anything else that would let me achieve the use case easily and let the business owners see the effects of their marketing (traffic, sales) would be interesting as well.
Related:
Using google analytics API to show subset of data for customers of web application
Google analytics customer data?
Google Analytics API: filter by URI?
https://embeddedanalytics.com seems like something that could be useful, but their page and graphs look like from a few years ago. I would like something more pretty.
https://oocharts.com seems to be interesting because of what their docs.oocharts.com says about queries. But they don't charge anything for their product so I am skeptical of their business model and whether it is a good long-term solution. update: dead link
I don't have enough karma to post links ;)
TLDR: Displaying subset of my GA data to my customers without forcing them to become GA users and adding them to my GA account.
Any help appreciated!
Without seeing your code it's hard to know where the problem is, but using the serverAuth option definitely works. And when using the serverAuth option, you don't need to specify a client ID or container, all you need to enter is the following:
gapi.analytics.auth.authorize({
serverAuth: {
access_token: 'Server side generated token'
}
});
Here's an example that will work if you enter in a valid access token and the idsfor a view to which you have access:
http://jsbin.com/vukezoheyeco/3/edit
Note: when doing auth like this, it happens sync. This can be a gotcha if you're used to an async auth flow (like normal) and you add an event handler listening for the "success" event after calling .authorize because then your handler will never run.
I think you need the Google Analytics Super Proxy
You download the github package and upload to your own App Engine project, do some minimal configuration and then you have an interface where you can setup Google Analytics API calls which require no user login.
It provides end user URLs that you can use to construct data tables in your front end, it also provides data-table format so it slots right into Google Charts.
So for example, you have a user that needs access to visits, revenue for site section /sectionA/
You set up the GA super proxy to serve them a URL that only includes data for that section - you can try out queries here in the GA query explorer. In this case, metrics=ga:visits,ga:productRevenue and filter~=ga:page=/sectionA/
This produces an end URL with JSON data, that refreshes daily/hourly - your choice. You import this URL into your app.
The end user then logs in to your app, and sees the chart data generated from the end URL for their login. They don't need to know about GA super proxy, they just see the end resulting chart.
You could get more sophisticated by providing dropdowns to select which data chart they see, which changes the GA super proxy URL that is requested.
I've created a web application that uses the Facebook API.
I would like to implement/create a method which is able to auto accept friend request of my own Facebook account.
Is this even possible and how to implement it in C#/ ASP.NET MVC?
Thank you in advance!
*I alreay read the Facebook Developers documentation https://developers.facebook.com/docs/howtos/requests/ but haven't been able to solve my 'problem'.
There is no API to send or approve friend requests.
There is the Friends Dialog but it sounds like you want this to work without user interaction which is impossible.
If you find some way to do this, you should report it via Facebook's whitehat bug bounty program, as it indicates a bug on Facebook's side.
How can I send a message to the currently logged in user from inside a Flex application contained in a Facebook iFrame and using the official AS3 Library for Facebook please?
To date the Graph API is the easiest way to work with facebook.
http://code.google.com/p/fbas/
It's far from a complete implementation, but Graph is so simple it shouldn't take long to implement any features you need.
NOTE: When I've used it I ported the javascript portion of the example code on the project's main page to AS3 & ExternalInterface. It reduced external dependencies to zero (with the exception of swfobject)
Facebook does not allow you to send messages . Either way , you can post to the user's friends feed on behalf of the user , with a custom message and the the notification for the post in feed will be displayed.
Post your request to http://graph.facebook.com/PROFILE_ID/feed
Requires the publish_stream permission.
You can refer this link http://facebooksdk.blogspot.com/2011/04/facebook-album.html