I was trying to create folder in google drive and upload file, but it didn’t work i think its the configuration problem. I used bearer token and it outputs this error
“OAuth2Credentials instance does not support refreshing the access token. An instance with a new access token should be used, or a derived type that supports refreshing.”
Here is the model
SET UP INFORMATION.bpmn (26.5 KB)
Hi @Abdulaziiz,
First of all thank you for using Camunda and for your question as well
Did you read this connector’s documentation, especially this FAQ question about authentication?
I know this is a bit specific so might have missed it.
Let me know if it helps.
Jonathan
1 Like
Thank you for you response @jroques - yeah i used that instruction to get the necessary credentials. I tried both methods bearer token and refresh token, but it still doesn’t work. And also there is no brief guidance and explanation how to configure those things.
I tried refresh token method but there is error saying this when i run my model
com.google.auth.oauth2.GoogleAuthException: com.google.api.client.http.HttpResponseException: 401 Unauthorized
POST https://oauth2.googleapis.com/token
Here’s some steps you might follow:
- Login to GCP Console
- In the top left dropdown, choose a project relevant to you
- Click on the menu button (3 lines at the top left), and go to
APIs & Services
→ Credentials
- Create yourself a client ID, and download credentials file
- Follow the script to obtain refresh token.
- With the client ID, client secret, and refresh token, you can execute opertions.
Note 1: please keep in mind that the Drive and Sheets connectors have different scopes. You might want to include a united set of scopes for all services to avoid regenerating refresh token.
Note 2: if you have a new account, you may need to go to the APIs dashboard, click Enable APIs and Services
button, and select the relevant services, e.g. Drive, Docs, Spreadsheets.
Last thing, could you tell me if the scripts are printing the tokens correctly?
@jroques - where should i run this? It didn’t work in cmd
from google_auth_oauthlib.flow import InstalledAppFlow
import pprint
SCOPES = [‘https://www.googleapis.com/auth/drive’, ‘https://www.googleapis.com/auth/documents’]
OAUTH_KEYS = ‘./oauth-keys.json’ # path to your file with OAuth credentials
def main():
flow = InstalledAppFlow.from_client_secrets_file(OAUTH_KEYS, SCOPES)
creds = flow.run_local_server(port=54948)
pprint.pprint(vars(creds))
if name == “main”:
main()
Do you have python3 installed?
Yeah I succeeded in creating a folder using google drive connector. But adding file in created folder is my problem now
So we solved the authentication then
Now you can check ours documentation to find a document templateId here.
Then it should be all good
Yeah thanks for you guys. I will check it and will back if there is any difficulty