Skip to content

Can we prevent connection creation?  #163

@Ripchanskiy

Description

@Ripchanskiy

Hello.
We created our custom Google SSO connector.
When user connect to this connector with account that doesn't have google workspace. Connector allows us to connect and we see that connector wiget connected at Workato UI.
But when we trying to start recipe that uses this connector we see error

We can't start this recipe due to connection errors
Google SSO is not connected.

It's confusing customers because it's not clear that we have connection issue.

But if account with Google Workspace it's works as expected.
So, do you know something about this broblem and how to fix it? It looks like workato widget issue

Here is how connector looks like

`
{
title: "TEST 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.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: {}
}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions