I followed the instructions to use the Java command line sample code (CalendarSample.java).
I'm authenticating using a Service Account and a locally stored key file. I'm trying to avoid using OAuth 2 and just authenticate programatically.
GoogleCredential.Builder builder = new GoogleCredential.Builder();
builder.setTransport(httpTransport);
builder.setJsonFactory(JSON_FACTORY);
builder.setServiceAccountId(ACCOUNT_EMAIL);
builder.setServiceAccountScopes(scopes);
builder.setServiceAccountPrivateKeyFromP12File(new File("key.p12"));
credential = builder.build();
where ACCOUNT_EMAIL is the long string I copied from the google console, something like
331155436243-he8e67ujkss8fgdj4di1lb7vjl4h7p6k#developer.gserviceaccount.com
I run the code, and I see the output such as:
Summary: Calendar for Testing 2
But when I go to the calendar for my own google account, I don't see the new calendars. I commented out the sample code where it deletes calendars, and when I run it again to display the existing calendars, it still shows
Summary: Calendar for Testing 2
Now, is that because it's creating the calendar in some new account (maybe accessed through that ACCOUNT_EMAIL above) rather than in my gmail account?
If I try to do
builder.setServiceAccountId("my.own.account#gmail.com")
or
builder.setServiceAccountUser("my.own.account#gmail.com")
the authorization fails.
What am I doing wrong?
Related
I am trying to geocode some addresses with python
so I created a freemium account on https://developer.here.com
my code is this
(...)
here = Here(here_config.app_id, here_config.app_code, timeout=5)
here.geocode(string_to_geocode)
I am getting the following error message:
HTTP Error 401: Unauthorized
my doubt comes from the difference between the terms "app_code" on my code sample and "app_key" on my credential screen.
Is there another step I need to do in order to get a "app_code" or is my "app_key" already supposed to be it?
P.S. on that same screen Here provides me an option of getting JAVASCRIPT keys, HERE SDK FOR IOS (PREMIUM EDITION) [this option cleary has a button that says "generate app_key and app_code", however, I am not developing a cellphone app, but a python program.
What am I missing ?
here_credential_screen
App ID and App Code have been replaced. We encourage all users to switch to API Key or OAuth 2.0 (JSON Web Tokens) authentication. Please be aware that as part of adapting to the new authentication method, some endpoints have also changed.
please check the new domains here
You can either use your ApiKey or App_Id/App_Code.
for example like this-
https://geocoder.ls.hereapi.com/6.2/geocode.json?apiKey={YOUR_API_KEY}&searchtext=425+W+Randolph+Chicago
https://developer.here.com/documentation/geocoder/dev_guide/topics/quick-start-geocode.html
I am trying to refresh oauth token in R using rgoogle analytics library in order to export data from Google Analytics. When I create new token and try to connect, everything works just fine. I am using the following code:
require(RGoogleAnalytics)
oauth_token<-Auth(client.id = "client_id", client.secret= "client_secret")
save(oauth_token, file="oauth_token")
Problem occurs, when I try to refresh token by using:
ValidateToken(oauth_token)
I always get
Error: Refresh token not available.
I already checked, whether the file is saved in current working directory, tried to rename file, move it to different directory and change accordingly current working directory, use absolute path in command, but nothing worked for me.
Any help would be appreciated.
I was having the same problem, and after some tries, what worked was to call init_credentials() in the token object.
Doing that the login page re-launches and the ValidateToken() worked again
oauth_token$init_credentials()
ValidateToken(oauth_token)
I want to get some data from Facebook, so I wanted to create application to get token for 60 days like I did few months ago. Then everything worked well, I just followed steps from the tutorial like this:
http://thinktostart.com/analyzing-facebook-with-r/
So It was enough to create "empty" application, write in R with proper id and secret
fb_oauth <- fbOAuth(app_id="123456789", app_secret="1A2B3C4D",extended_permissions = TRUE)
fill website page as http://localhost:1410/ and autenthication was complete and I was able to make get some data from facebook. It seems that it is not so easy anymore.
When I try to follow exactly the same steps it seems that now I have to fill in my application (with some description, photos...) and "send" it to submission.
Do you have similar problem or I just miss something? I just want to use information from facebook for my own use, not for business or something. Is there any (other) way to get a token for R which allows me to get some information from Facebook without filling application. I don't think that filling it with some fake data will pass facebook verification.
I just want to use information from facebook for my own use
Then you don’t need to submit it for review.
See https://developers.facebook.com/docs/apps/faq#roles – it explains that you can ask any user that has a “role” in the app (meaning admin, developer or tester) for any permission without prior review.
For one, this is of course implemented this way, so that people can actually test the functionality they are developing properly. And it is also an “official loophole” for apps such as yours, that are for “private use” only, and not meant to be used by the general public in the first place.
(And this has nothing whatsoever with the Rfacebook package – it is the same for all apps, no matter what framework/SDK they might be using.)
UPDATE
As #CBroe said earlier, you do not need an approved app, you just need to add the users of the app as admin in the app's role menu in Facebook Developers.
Follow these steps and you will get your permanent FB token:
Create new application at https://developers.facebook.com/apps/ with basic setup
Fill in the app name in lower case and without the words Facebook or FB for display name and namespace, category set to Business
In "Settings/Basic" I added a new "Website" platform with the URL of http://localhost:1410/ and localhost as the "App Domain"
In the "Settings/Advanced" tab I added http://localhost:1410/ as the Valid OAuth redirect URIs
Then, run this code:
library(httr)
app <- oauth_app('facebook', appid, appsecret)
Sys.setenv("HTTR_SERVER_PORT" = "1410/")
tkn <- oauth2.0_token(
oauth_endpoints('facebook'), app, scope = c('ads_management', 'read_insights'),
type = 'application/x-www-form-urlencoded', cache = FALSE)
save(tkn, file = "~/Documents/RFiles/fb_token") # save the token for future use
Make sure you put 'read_insights' in scope, otherwise you are not telling Facebook what kind of permissions you want the app to take.
Finally you can use the token:
library(Rfacebook)
load("~/Documents/RFiles/fb_token")
I need to display 'Pure HTML Dashboards' or 'Custom Components' as depicted in the following link https://ga-dev-tools.appspot.com/demos/embed-api/
I have google analytics account & it shows me the real time statistics perfectly for my website, but i need to display the same using the api as shown in the following link:
https://github.com/googleanalytics/embed-api-demos/blob/master/site/3-custom-components.html
I have replaced my client id in the following code:
gapi.analytics.auth.authorize({
container: 'auth',
clientid: '623325626209-j1jm9d78ge0v4uf8b9cor31qsirungrq.apps.googleusercontent.com',
});
I also updated the end date to current date as follows:
query: {
'metrics': 'ga:sessions',
'dimensions': 'ga:date',
'start-date': '30daysAgo',
'end-date': '2014-09-05'
},
So when i run the code it shows a button "Access Google Analytics", when i click on it i get the following error:
That’s an error.
Error: origin_mismatch
Application: Project Default Service Account
You can email the developer of this application at: fz1990#gmail.com
Request Details
=
scope=https://www.googleapis.com/auth/analytics.readonly https://www.googleapis.com/auth/userinfo.email
response_type=code token id_token gsession
redirect_uri=postmessage
cookie_policy=single_host_origin
proxy=oauth2relay591552393
state=524099008|0.3938720987
origin=http://localhost:27363
include_granted_scopes=true
client_id=656169223314-dbc8l4c7ro20hn8vcqqtd9rhd0e6arcb.apps.googleuserconte
Can somebody plss help me to fix this issue?
Thanx in advance
Origin mismatch is normally caused by the Javascript origins not being set correctly in the API project console. You need to make sure that the Javascript origins match the domain from which your requests are coming and to which you are returning the user after sign in.
In your case you are still using the client_id from the tutorial you need to create your own. More details can be found in the developer documentation for the embeded API in the "Create a client ID and client secret" section.
Basilcy you need to go to Google Developer console and register your application. The link above to the documentation will walk you though creating that. Hint: don't for get to add a product name and email address.
At this time the Real-time API is still in beta you will need to apply for access to it. Real time reporting api private beta fill out that form you wont hear anything from Google just wait 24 hours and give it a try it normally works by then.
I am trying to develop a “connect with facebook” with ASP.NET 3.5 and have followed lots of articles but I am not able to get it working. Most of the developers who spoke about this matter end up referring to the below article:
devtacular.com/articles/bkonrad/how-to-retrieve-user-data-from-facebook-connect-in-aspnet/
I followed that article, but the only thing I was able to get working was checking the authentication status of the current user:
devtacular.com/articles/bkonrad/how-to-integrate-with-facebook-connect/
However, trying to read users’ data gives me the following error all the time (although the same key was used in the previous successful test! - checking the authentication):
Invalid API key specified
The app you are trying to access does not exist or has been disabled.
The link to the 2 pages I developed are below, you may try them to see what I have done:
http://www.myifaworld.com/desktopModules/facebook/connect.aspx (the connect method - works fine)
http://www.myifaworld.com/desktopModules/facebook/bkonrad_1.aspx (reading users data - error)
I basically want users to click on the “connect with facebook” on my page to login using facebook and my code reads users’ info and save the users’ basic information to my database.
Any help is highly appreciated!
Checked your both pages
Your user data page gives below error.
FB.Event is undifined.
and also you dont have the refeence to the fb script above your code.
try adding these lines in your code above FB.Init
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
Read my blog for deail facebook connect integration
http://codethatworkedforme.blogspot.com/2011/08/facebook-connect.html