Refresh oauth token in R using rgoogle analytics - r

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)

Related

"Error 404" when posting SignOutUser to Firebase

I write a code to access Firebase.
I use HTTPRequest to login, register, delete account etc.
All work well but one method - logout = SignOutUser - always returns with 404 Error, unknown URL.
Links that work with HTTPRequest:
https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyPassword?key=%s
https://www.googleapis.com/identitytoolkit/v3/relyingparty/signupNewUser?key=%s
https://www.googleapis.com/identitytoolkit/v3/relyingparty/deleteAccount?key=%s
(with proper API key added to the string, of course)
And the one that doesn't work:
https://www.googleapis.com/identitytoolkit/v3/relyingparty/signOutUser?key=%s
What can be the problem? Can it be fixed?
Is there any other way to logout a user?
I write the code in gdscript, but I tried it via web code too, same result.
Thank you in advance!

Firebase (Firechat) "Route not found." error

I have been trying to use the firebase fire chat, it works using the default demo url (http://firechat.firebaseapp.com). However, as soon as I change it to my URL it does not work, even though I have enabled twitter login, and I have twitter authentication working on another firebase app. The error message I get is the following:
{"error":{"code":"ROUTE_NOT_FOUND","message":"Route not found."}}
Any idea?
source: https://github.com/firebase/firechat
The twitter callback url for your app should be:
https://auth.firebase.com/v2/your-firebase-app-name/auth/twitter/callback
I found the answer, in the Twitter app settings, the following option was ticked. So, I untucked it and it is now working
Enable Callback Locking (It is recommended to enable callback locking to ensure apps cannot overwrite the callback url)
you need to set Callback URL in https://apps.twitter.com/app/xxxxxx/settingsfor example, https://auth.firebase.com/v2/xxxxxxx/auth/twitter/callback

Don't see .httr-oauth file after use of setup_twitter_oauth; want to use it to work with StreamR

I am trying to use setup_twitter_oauth authentication (from TwitteR package) to later on run StreamR search.
There is a related question in Stackoverflow about the same subject -
Retrieving cached oauth token with packages httr, twitteR, and streamR
However my problem that I don't see .httr-oauth file in my working directory
The code I use to establish connection with Twitter is below
setup_twitter_oauth(consumer_key, consumer_secret, access_token=NULL, access_secret=NULL)
(I use proper keys from my registered Twitter App)
It works I am getting [1] Using direct authentication message after execute it.
However there is no file called .httr-oaut in my work directory. Other hidden files are visible.
getOption("httr_oauth_cache") returns TRUE
What am I doing wrong and how can I get this file and use it in the future to establish connection with Twitter using StreamR, like for example in the command below
filterStream( file="tweets_rstats.json", track="rstats",
locations=c(-74,40,-73,41), timeout=600, oauth=my_oauth)
As I understood I need to pass it as oauth, so need in some way to save the token in my_oauth variable
Any help is appreciated

Getting Access Token Data From OAuth Template of Asp.net

I'm trying to get access token of facebook client when a user logged in with asp.net's oauth template. But I couldn't acquire the access token when i tried some methods that i found on internet like;
AuthenticationResult result = OpenAuth.VerifyAuthentication("RegisterExternalLogin.aspx");
string actok = result.ExtraData["accesstoken"];
This try wasn't successfull. How can i acquire the access token?
I see noone has replied to your question even though it has been 10 days so I'll take a stab at it.
You mentioned that you are using asp.net's OAuth template. So I think you are looking at the line
AuthenticationResult result = OpenAuth.VerifyAuthentication("RegisterExternalLogin.aspx");
in the ExternalLoginCallback() action in AccountController.cs
As far as I can tell your syntax is correct. In fact also tested it out myself and it works. I guess you can try another way of accessing the same property
String myaccesstoken_value1 = result.ExtraData.Values.ToArray()[5];
That will give you the same result as result.ExtraData["accesstoken"]
If that does not work either then I would imagine that there is some problem with the authentication itself, rather than with your syntax here. I'm assuming you have VS2012 Express, so use the debugger to see what values are present in your variable 'result'. If it is empty, then it would indicate why you second statement errors out, and it would also indicate that there is a problem in the code before you get to this point.
Also keep in mind during testing that when you log into your app using OAuth providers such as Facebook, even when you log out of the website you continue to remain logged into facebook. You actually have to go to facebook.com and click logout there also (unless you write some additional code in your asp.net app to do a remote logout). I don't know if this applies to your situation, just giving you a heads up.
Please vote if this helps.

weird problem - OAuthException - Access Token

Yesterday I noticed problem with my application. Everything was fine, but now something is wrong with button and postbacks.
I get error:
(OAuthException) (OAuthException) An active access token must be used to query information about the current user.
while im trying use .Get("me") info # postback.
I set a watch on reguest.params(signed_request) and everyting is fine, but when I click button on my app to make postback, my request.params(signed_request) value is nothing.
Any ideas how to solve problem ?
(im using 4.2.5 (?) sdk and 5.0.6 show me the same error)
Pass access token parameter to FacebookWebClient constructor:
new FacebookClient(FacebookWebContext.Current.AccessToken);

Resources