test: lambda do |_connection| get("/admin/reports/v1/activity/users/all/applications/token") end,
triggers: {} }
It works with Google Workspace accounts.
But, connector allows to connect every account and workato will show this connector as connected.
When i start recipe which use this connector, i got
We can't start this recipe due to connection errors
Google SSO is not connected.
If i navigate to connector via link - it will be disconnected
If i refresh page - it's connected.
I understand that this is the problem with customer permissions. Maybe some customers use regular Google accounts But, i need some check in my connector. I want to refuse connection(ideally show some error message to customer) If some endpoint doesn't work. For instance, call some admin sdk endpoint and so on. How can i do it?
Sergiy. ripchanskiy
Google Connector issue
Hello.
I created Google Workspace connector
Here is code:
{
title: "Google SSO",
connection: {
fields: [
{
name: "client_id",
optional: false
},
{
name: "client_secret",
optional: false,
control_type: "password"
}
],
authorization: {
type: "oauth2",
authorization_url: lambda do |connection|
scopes = [
"https://www.googleapis.com/auth/admin.reports.audit.readonly",
"https://www.googleapis.com/auth/admin.reports.usage.readonly",
"https://www.googleapis.com/auth/admin.directory.user.security",
"https://www.googleapis.com/auth/admin.directory.user.readonly"
].join(" ")
"https://accounts.google.com/o/oauth2/auth?client_id=" \
"#{connection['client_id']}&response_type=code&scope=#{scopes}" \
"&access_type=offline&include_granted_scopes=true&prompt=consent"
end,
acquire: lambda do |connection, auth_code, redirect_uri|
response = post("https://accounts.google.com/o/oauth2/token").
payload(client_id: connection["client_id"],
client_secret: connection["client_secret"],
grant_type: "authorization_code",
code: auth_code,
redirect_uri: redirect_uri).
request_format_www_form_urlencoded
[response, nil, nil]
end,
refresh: lambda do |connection, refresh_token|
post("https://accounts.google.com/o/oauth2/token").
payload(client_id: connection["client_id"],
client_secret: connection["client_secret"],
grant_type: "refresh_token",
refresh_token: refresh_token).
request_format_www_form_urlencoded
end,
refresh_on: [401],
detect_on: [/"errors"\:\s*\[/],
apply: lambda do |_connection, access_token|
headers("Authorization" => "Bearer #{access_token}")
end
},
base_uri: lambda do |_connection|
"https://www.googleapis.com"
end
},
object_definitions: {},
custom_action: true,
test: lambda do |_connection|
get("/admin/reports/v1/activity/users/all/applications/token")
end,
triggers: {}
}
It works with Google Workspace accounts.
But, connector allows to connect every account and workato will show this connector as connected.
When i start recipe which use this connector, i got
We can't start this recipe due to connection errors
Google SSO is not connected.
If i navigate to connector via link - it will be disconnected
If i refresh page - it's connected.
I understand that this is the problem with customer permissions. Maybe some customers use regular Google accounts
But, i need some check in my connector. I want to refuse connection(ideally show some error message to customer)
If some endpoint doesn't work. For instance, call some admin sdk endpoint and so on.
How can i do it?