I am trying this quickstart.py example given on the page: https://developers.google.com/sheets/api/quickstart/python
I have created these credantials:
I have credentials.json in the same location as quickstart.py
when I run the command python quickstart.py I get this authorisation access error.
How can I fix this Authroisation error?
The issue you are having is that you created the client credentials json on one user's account. Yet you are authorizing the application from another user.
Because your application is still in test and has not been verified yet you need to add each user as a test user over in the google developer console.
Under the Oauth screen simply add the user:
Note: you can only have 100 test users and you can not remove someone once they have been added.
Related
I've been using GCP for some time.
I created a new GCP Project to test new functions, and enabled the Runtime API.
However, clicking Deploy pops up this message:
"User does not have the 'iam.serviceAccounts.actAs' permission on webcalc-taskc2#appspot.gserviceaccount.com required to create the function. You can fix this by running gcloud iam service-accounts add-iam-policy-binding webcalc-taskc2#appspot.gserviceaccount.com --member=user: --role=roles/iam.serviceAccountUser"
I entered this into Shell, replacing with my Owner email for GCP. Still no luck ;(
You have to add permissions that can use service account to your account.
According to Google document, A service account is a special type of Google account intended to represent a non-human user that needs to authenticate and be authorized to access data in Google APIs.
Seems that "webcalc-taskc2#appspot.gserviceaccount.com" is your service account runs cloud function.
The pop up message you received said that a user account running cloud function does not have 'iam.serviceAccounts.actAs' permission on that service account.
So you have to entered command in the message with replaced --member=user to --member=user:Your account email.
You can check your cloud function service account at details -> General information tab.
I'm new to using Google APIs in general. Could anyone help me figure out how to set up this tasks API correctly for my python/flask/sqlalchemy application?
I got the API key, client ID (and downloaded as credentials.json), pip installed the Quickstart for python, created the quickstart.py and credentials.json with provided code but when I ran that quickstart.py file, it says
"Error 400: redirect_uri_mismatch.
The redirect URI in the request, http://localhost:51014/, does not match the ones authorized for the OAuth client. To update the authorized redirect URIs, visit: https://console.developers.google.com/apis/credentials/oauthclient/${your_client_id}?project=${your_project_number}"
When I tried each time, the port number kept changing.
On my terminal, it says
"lease visit this URL to authorize this application: https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=624465110094-oa56kshqc0vml0k2uju45ro7tjg0jo8j.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A51014%2F&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Ftasks.readonly&state=8MQQOCU8Do80dheS9iuRZJnG2E1gzx&access_type=offline"
I think I set up the wrong URI somehow. Could someone tell me the correct way of setting up the OAuth consent screen section? For my project, I ran my app on localhost:5000 then deployed it to Heroku (mysite.herokuapp.com). I'm not sure what I need to put on "Authorized domains" field and "Application homepage link". (I didn't add anything under " Add Scope".)
Also under "credentials" section, what URI I should put in the "Authorized JavaScript origins" and "Authorized redirect URIs" field? So far I put "http://localhost:5000" and it's not accepting this format. So left it blank but I got this error 400 at the end. For "type", I chose "web application". Should I choose web server instead?
Thanks!
I am trying to access a gmail account so I can read emails and save PDFs attached to those emails. I wrote the code and it works fine when I tested it on my personal gmail account (something#gmail.com), but now that I am trying to do it for this new address (reporting#company.com, which is a gmail business account) my code isn’t working to even connect.
I get an error message saying
Error: b’[AUTHENTICATIONFAILED] Invalid Credentials (Failure)’
I know the login email and the password are both correct. I have already downloaded the credentials.json file from the Google API page.
My code is as below:
Mail = imaplib.IMAP4_SSL(“imap.gmail.com”)
Mail.login(“reporting#company.com”,’password’)
If you're still using a password in your code, then you need to get your users to enable Less Secure Apps, or if they're using 2-Step Verification, create an App Password.
However, a better approach would be to use OAuth instead of a password. If you've downloaded the credentials.json file from the Google Developers Console, you already did the first step. :) Google has a guide to use OAuth with IMAP in Python, as well as a code sample (see the TestImapAuthentication method there).
All I had to do was enable 2-step authentication on the google account.
I try to run a python script as a cronjob on my server using the facebook business sdk. The purpose of the script is to get a random product of our shop and to publish a post, promoting the product from the shop.
To do so, I need the page permissions for manage_pages and publish_pages. All this works fine while the app is in development but when I try to use it in live modus, the token does not get accepted. I tried to get a new token, but as I understand it, I can't get the permissions unless I request an App Review.
Did I get this right?
And how to do so for a simple python script that runs on my server as a cronjob?
Thank you!
You're right that you need to do an App Review to get the permissions to work in production. We've run into the same issue, all of our stuff is through cron jobs where we already have access to the accounts and access tokens for every account, but we didn't have permissions. We contacted Facebook and they said in order to get the permissions we need to do a full App Review.
I want to create Python project to get data from Google Analytics from a certain page.
I have created new project in Google Console (console.google.developers.com) and got my OAuth 2.0 credentians in JSON format. I'm loosely following this tutorial: Python QuickStart.
I already got redirected to OAuth and selected my account but the script is getting
"User does not have sufficient permissions for this profile".
Will adding access to my user in Google Analytics be enough?
And how to run this project from shell on a remote server? I will not have the ability to just open browser and select Google account in CLI...
"User does not have sufficient permissions for this profile".
The user you are authencating with does not have access to the google analytics account you are trying to access. this would be the profile id that you are using in your code.
make sure that you are authencting your appliction using the same user you are using to log into google analytics
double check the profile id that you are using in your code.