Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having issues with Access Token #86

Closed
Tiago-SD opened this issue Jun 28, 2022 · 3 comments
Closed

Having issues with Access Token #86

Tiago-SD opened this issue Jun 28, 2022 · 3 comments

Comments

@Tiago-SD
Copy link

Hello,

I'm using this provider for the first time. I've setup with success the oauth on the site24x7 console. The following is my configuration on the terraform side:

terraform {
    required_providers {
        site24x7 = {
            source = "site24x7/site24x7"
            version = "1.0.17"
        }
    }
}

provider "site24x7" {
    data_center = "EU"
    retry_min_wait = 1
    retry_max_wait = 30
}


resource "site24x7_amazon_monitor" "aws_monitor_site24x7" {
  // (Required) Display name for the monitor
  display_name = "Test"
  // (Required) AWS access key
  aws_access_key = var.AWS_ACCESS_KEY_ID
  // (Required) AWS secret key
  aws_secret_key = var.AWS_SECRET_ACCESS_KEY
  // (Optional) AWS discover frequency
  aws_discovery_frequency = 5
  // (Optional) AWS services to discover. See https://www.site24x7.com/help/api/#aws_discover_services
  // for knowing service ID.
  aws_discover_services = ["3"]
}

I've set up the environment variables SITE24X7_OAUTH2_CLIENT_ID, SITE24X7_OAUTH2_CLIENT_SECRET and SITE24X7_OAUTH2_REFRESH_TOKEN. Although I'm having the following error on the terraform apply:
Error: POST https://www.site24x7.eu/api/monitors: giving up after 5 attempts due to: Post "https://www.site24x7.eu/api/monitors": oauth2: server response missing access_token.

I would like to ask help.

Thanks in advance,
TIago

@jim-billy-zoho
Copy link
Collaborator

@Tiago-SD Please refer this issue #61.

@Tiago-SD
Copy link
Author

Hello @jim-billy-zoho,

There is one thing different in my setup. I'm using our own IdP so it will probably not work with that approach. Any thoughts about it? Can it be that I'm missing something on the configuration?

Many thanks for your help on this.

Thanks,
Tiago

@jim-billy-zoho
Copy link
Collaborator

Hi @Tiago-SD,

We don't support authentication via IdP.
For fetching SITE24X7_CLIENT_ID, SITE24X7_CLIENT_SECRET and SITE24X7_REFRESH_TOKEN, visit https://api-console.zoho.com/ and choose the self client option. Copy Client ID, Client Secret and paste them in the below command. Please give Site24x7.account.All,Site24x7.admin.All,Site24x7.reports.All,Site24x7.operations.All,Site24x7.msp.All,Site24x7.bu.All in the scope field and click the "Create" button. Copy the generated code, paste it in the below command and execute the same.

curl https://accounts.zoho.com/oauth/v2/token
-X POST
-d "client_id=<CLIENT_ID>"
-d "client_secret=<CLIENT_SECRET>"
-d "code=<GENERATED_CODE>"
-d "grant_type=authorization_code" --insecure

Command output will be similar to the one below

{"access_token":"1000.sdfsdf.sdfsdf","refresh_token":"1000.asdqwewqe.qweqwe","api_domain":"https://www.zohoapis.com","token_type":"Bearer","expires_in":3600}

In your terraform file, please configure the client ID, client secret and refresh token in the above command output.

Please let us know if you face any issues.

Thanks & Regards,
Jim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants