googlesheets4 (R package) oauth token suddenly stopped working - r

I have started getting this error from today when I do any write operation on my googlesheets... while till a few days back everything was working fine.
> gs4_create()
✔ Creating new Sheet: petalless-spider.
Auto-refreshing stale OAuth token.
Error in `gargle::response_process()`:
! Client error: (403) PERMISSION_DENIED
• Client does not have sufficient permission. This can happen because the OAuth token does not have the
right scopes, the client doesn't have permission, or the API has not been enabled for the client
project.
• Request had insufficient authentication scopes.
Error details:
• reason: ACCESS_TOKEN_SCOPE_INSUFFICIENT
• domain: googleapis.com
• metadata.method: google.apps.sheets.v4.SpreadsheetsService.CreateSpreadsheet
• metadata.service: sheets.googleapis.com
Following is my gs4_oauth_app:
gs4_oauth_app()
<gargle_oauth_client>
name: planar-unity-23xxxxxxx3ae35c6
id: 26xxxxxxx50sk26li1edt07gscl.apps.googleusercontent.com
secret: <REDACTED>
type: installed
redirect_uris: http://localhost
the secrets matches with the downloaded json from google cloud console (screenshot attached):
The only changes I did in last few days is open a new google workspace account. However I am logged into the old gmail account and also confirm the account whenever being prompted by googlesheets4 package.

Related

Firebase iOS Auth with Twitter + Make requests on backend (403 status code)

i've succesfully integrated Twitter Auth via my iOS app and firebase, as explained here: https://firebase.google.com/docs/auth/ios/twitter-login
I'm able to get an oauth access token + secret from the user that authorizes the connection via app.
My intention was to use the oauth access token to make requests via the node-twitter-api-v2 library, for example - fetching the user's bookmarks.
I tried using the access token in place of the "bearer token" when initializing the TwitterApi client, but am still getting the error:
Authenticating with OAuth 2.0 Application-Only is forbidden for this endpoint. Supported authentication types are [OAuth 1.0a User Context, OAuth 2.0 User Context].
From my understanding, such requests must be made via a "logged in" client and the v2 api - question is, is there a way to use the already authed user's (via app) token to make the request / log in? This is done via background + backend, so the idea is that there is no UI / callback to make the user go through to create the logged in session.
Any ideas on how to approach this or if it's even possible?
Example code:
//call the new v2 api
const bookmarkedTweets = await this.twitterClient.v2.bookmarks({
max_results: max_fetch_limit,
expansions: ['attachments.media_keys'],
'media.fields': ['preview_image_url', 'url', 'variants'],
'tweet.fields': ['created_at', 'entities', 'attachments', 'author_id', 'conversation_id', 'id', 'text'],
});
Error response:
data: {
> title: 'Unsupported Authentication',
> detail: 'Authenticating with OAuth 2.0 Application-Only is forbidden for this endpoint. Supported authentication types are [OAuth 1.0a User Context, OAuth 2.0 User Context].',
> type: 'https://api.twitter.com/2/problems/unsupported-authentication',
> status: 403
> }
From what i read in twitter docs, once we get the token form user, all we need to do is just call the endpoints with the token as the Bearer, but this does not seem to work (maybe i read instructions wrong).
**
* Create a new TwitterApi object with OAuth 2.0 Bearer authentication.
*/
constructor(bearerToken: string, settings?: Partial<IClientSettings>);
Any help would be greatly appreciated. Thank you

403 Forbidden - These credentials do not authorize access - weather here api forecast_astronomy

Using the weather here api with product of forecast_astronomy and now all of sudden getting a 403 forbidden error on the request of "These credentials do not authorize access". The url request has not changed in the code and I have verified in the developer portal that the app id is enabled still.
This was working fine when last tried two days ago.
Tried directly in curl and postman and getting same 403 forbidden error:
{
"error": "Forbidden",
"error_description": "These credentials do not authorize access"
}
I can imagine two reasons:
you did not verify your email address after registering the account. If that's the case, please do so now.
you have consumed the allowed amount of transactions and the app_id got deactivated. The time you looked for the status it was re-activated again due to reaching the anniversary date.

Facebook API v3.2 connection issue with Rfacebook package in RStudio

I'm connecting to Facebook API v3.2 in order to get my friends information. I had the following error:
Invalid Scopes: user_relationships, publish_actions. This message is only shown
to developers. Users of your app will ignore these permissions if present. Please
read the documentation for valid permissions at:
https://developers.facebook.com/docs/facebook-login/permissions
How to fix this issue using API v3.2?
I have proceeded to the following steps:
I connect to the Facebook API via App: I have created a new Facebook APP (from https://developers.facebook.com) and set it up by default.
I connected to the Facebook API v3.2 via authentication token (from https://developers.facebook.com/tools/explorer) and I obtained access token of all necessary permissions.
I used this R code in RStudio to connect to my API:
install.packages("devtools")
library(devtools)
# I used install_github to get the updated version of Rfacebook package
install_github("pablobarbera/Rfacebook", subdir="Rfacebook")
require (Rfacebook)
I used this fb_oauth to connect my R session with the App I already created and authenticate it to my Facebook profile for Data Mining.
fb_oauth <- fbOAuth(app_id="My_APP_ID", app_secret="MY_APP_SECRET_KEY", extended_permissions = TRUE)
I expect that the token will give access to some of the authenticated user's private information (birthday, hometown, location, relationships) and that of his/her friends, and permissions to post status updates as well as to access check-ins, likes, and the user's newsfeed.
But I got the following error on RStudio command line.
Copy and paste into Site URL on Facebook App Settings: http://localhost:1410/
When done, press any key to continue...
Waiting for authentication in browser...
Press Esc/Ctrl + C to abort
Authentication complete.
Error in oauth2.0_access_token(endpoint, app, code = code, user_params = user_params, :
Bad Request (HTTP 400). Failed to get an access token.

mendeley plugin on wordpress Failed retrieving OAuth2 access token:

I am trying to connect my mendeley to my wordpress account.
However, I keep getting this error:
Failed retrieving OAuth2 access token: {"message":"Credentials are required to access this resource."}
Any advice/help?

RGA Invalid Credentials

I try to use the RGA Package (https://github.com/artemklevtsov/RGA) to get Data from Google Analytics core API.
authorize(
client.id=options()$apiSecrets$id,
client.secret=options()$apiSecrets$clientSecret,
cache=paste(getwd(),"daToken",sep="/")
)
So the cache is set to something like /User/foo/bar/daToken. I can see the file and everything works just right, I can access the data for now. After 30-60 minutes however the token expires it seems. Now on a new attempt there will be the error message Error : client error: (401) Unauthorized Auth error: Invalid Credentials
Why is the token not working any more? How to setup a longer live time? Plus: why is there an error and why does RGA don't try to get a new token?
Please read Google Oauth 2.0 documentation properly.
Access Token has lifetime of only 3600 seconds. After that you have to use Refresh Token to get new Access Token.
I have not used RGA package but I am sure there must be some mechanism to validate and refresh the Access Token.

Resources