Skip to content

Gandi Personal Access Token support - #568

Merged
qdm12 merged 3 commits into
qdm12:masterfrom
varner-owl:add-gandi-bearer-token
Jan 14, 2024
Merged

qdm12 merged 3 commits into
qdm12:masterfrom
varner-owl:add-gandi-bearer-token

Conversation

@varner-owl

@varner-owl varner-owl commented Dec 10, 2023 •

Copy link
Copy Markdown
Contributor

Currently authentication for updates to Gandi domains can only be done with the Gandi API key. Gandi has depreciated the API key in favor of Personal Access Tokens.

This PR adds the option to authenticate using a Personal Access Tokens but does not require a token to be used instead of an API key. This should not break anyone's current configurations or require updates to their configuration files. This implementation produces a KeyNotSet error only if both the API Key and Personal Access Token are not provided or are empty the config file. If both an API key and Personal Access Token are provided, it will default to using the Token for authentication. It does not use the API key as a fall back (i.e. if authentication via Token fails, try again with the API key), but this could be implemented in the future if desired.

Example config.json with different possible valid configurations:

{
    "settings": [
        {
            "provider": "gandi",
            "domain": "mydomain.com",
            "host": "@",
            "key": "mysecretkey",
            "ip_version": "ipv4"
        },
        {
            "provider": "gandi",
            "domain": "mydomain.com",
            "host": "@",
            "token": "mypersonalaccesstoken",
            "ip_version": "ipv4"
        },
        {
            "provider": "gandi",
            "domain": "mydomain.com",
            "host": "@",
            "key": "mysecretkey",
            "token": "mypersonalaccesstoken",
            "ip_version": "ipv4"
        }
    ]
}

@Trambert

Trambert commented Jan 3, 2024

Copy link
Copy Markdown

Hello,
This is becoming urgent, Gandi's API endpoint deprecated the use of the API key today.
Thank you very much for your work!

varner-owl and others added 2 commits January 3, 2024 23:32
- Change `token` -> `personal_access_token`
- Remove `key` from documentation although it still works
- Minor code changes and comment simplifications
@qdm12

qdm12 commented Jan 14, 2024 •

Copy link
Copy Markdown
Owner

This is becoming urgent, Gandi's API endpoint deprecated the use of the API key today.

By "deprecated", it should still work right? It's just that the PAT is now the preferred method right?
I reviewed the code and made changes, I'll merge this in a few minutes anyway.

Notable changes I did:

  • Change token -> personal_access_token in the JSON, to avoid any confusion regarding API key vs personal access token.
  • Remove key from documentation docs/gandi.md, although it still works

EDIT: Also very sorry for the big delay reviewing this, I've been swamped with life and other repositories, I didn't have time to get back to this repository.

@qdm12
qdm12 merged commit ee495bb into qdm12:master Jan 14, 2024
@varner-owl

Copy link
Copy Markdown
Contributor Author

This is becoming urgent, Gandi's API endpoint deprecated the use of the API key today.

By "deprecated", it should still work right? It's just that the PAT is now the preferred method right? I reviewed the code and made changes, I'll merge this in a few minutes anyway.

It was also my understanding that PAT is just the preferred method now. Although I stopped using the API key last month, I just checked again and the API keys still work and Gandi has not updated their documentation to say anything about the removal of API keys. Either way, thanks for merging it and for all the work you do on all these repositories!

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

Successfully merging this pull request may close these issues.

3 participants