Comments (13)
The difference between the Public and Secret API keys is poorly documented. (I'll bring it up with our UX/Documentation guys in our next meeting)
Let me explain how things work currently
The API keys are available on the dashboard screen when you log into your mailgun account (https://mailgun.com/app/dashboard)
The Public API Key is used for Email validation See Email Validation API Documentation
The Secret API Key is used for all other API calls
+1 to the idea of changing the name to "Email Validation Key" I would even be in favor of moving any API calls that require the Public API Key out of the Mailgun
interface an into a separate interface. Such that mailgun-go users only need to pass in the public or private api keys into the constructor.
// Majority of the api calls
mg := mailgun.NewMailgun("example.com", "key-5c56vw23dfs42334fd")
// Email Verification
ev := mailgun.NewEmailVerification("pubkey-5c56vw23dfs42334fd")
err := ev.Verify([]string("[email protected]", "[email protected]"])
This will break the current golang public api but I'm ok with that. Current users can continue to use gopkg.in/mailgun/mailgun-go.v1
. After this change we will bump to v2
@mbanzon @javiermanzano @bryancallahan Thoughts?
from mailgun-go.
Got it. I think.
from mailgun-go.
@boivie that seems like a good idea - the dual keys seem to cause some confusion.
from mailgun-go.
Would really appreciate this. Ran into some confusion myself just yesterday. 👍
from mailgun-go.
I have ran into same confusion today. Other sdks (like node's https://github.com/mailgun/mailgun-js) only asks for one of them.
I know I can find one of them inside domains, but where can I find the other?
@bryancallahan can you help me with that?
Thanks
from mailgun-go.
I have created a pull request to fix the documentation.
mailgun/documentation#355
from mailgun-go.
This whole thing is still confusing. Keys are labeled different across the UI and the libraries, this library doesn't specify the correct go import path, and I don't seem to get any intellisense on the mailgun types. It's a simple enough API, but it's like it's made 2x more difficult trying to wade through all this.
from mailgun-go.
@alexsasharegan The use of the public and private API keys can be confusing and we have had a few internal discussions on how to improve. Outside of those discussions I've separated the use of the private and public keys in the mailgun-go library and made notes on what keys to use and where. My hope was to make things a bit clearer.
See https://github.com/mailgun/mailgun-go/blame/master/README.md#L32-L33
and
https://github.com/mailgun/mailgun-go/blame/master/README.md#L167-L170
If you have further suggestions we are interested in your thoughts.
from mailgun-go.
Regarding keys
When I visit my mailgun domain, I see these options:
Default Password
as a hex encoded string with format\h{32}-\h{8}-\h{8}
API Key
as a hex encoded string with format\h{32}-\h{8}-\h{8}
This doesn't match any of the key-
or pubkey-
patterns, so while I have my application code working,
this is still confusing to me.
Regarding Imports
I know this one is a little off topic for this issue, but the readme shows importing the library like so:
"github.com/mailgun/mailgun-go/v3"
This does not resolve with the go get
command. Removing /v3
does work. Most libraries include the go get command at the top of their readme, and I think including a working command would be a helpful addition.
Also note that the package path is listed the same on your .com documentation:
from mailgun-go.
paths ending in /3
is how golang 1.11 modules differentiate between major version changes. If you are using golang 1.10 or older or not using modules support. go get
will not know how to pull the library properly.
See https://github.com/golang/go/wiki/Modules
I'll ask the security guys about your lack of key-
prefix for your API key. My API key has a key-
prefix. I'll find out and get back to you.
from mailgun-go.
Thanks for the info on the modules. I'm up to date with go 1.11, but not using modules yet. I'll have to learn what's going on here! I imagine that's to blame for my lack of intellisense in vscode as well.
from mailgun-go.
@alexsasharegan word from the security guys is that you have the new style token. I have the old style token with the key-
prefix.
If you look at your dashboard https://app.mailgun.com/app/dashboard (once you login) You will see 'API Keys' on the bottom right, which includes the Public Validation Key
and the Private API Key
.
I'll change the Public key
to Public Validation
in the documentation, hopefully that will avoid some of the confusion.
from mailgun-go.
This might come up again, but until then I'm closing this.
from mailgun-go.
Related Issues (20)
- Make fields public in struct `mailgun.Message`. HOT 3
- SetDeliveryTime Ignored HOT 1
- Change response for `VerifyDomain` method from (string, error) to (DomainResponse, error) HOT 2
- How to convert json stored messages to url.Values HOT 1
- Make properties on Message struct publicly accessible HOT 2
- missing `result` in email validation response HOT 4
- VerifyAndReturnDomain is missing from the Mailgun interface
- Validate domain in mg.Send()
- Allow to use : in domain for testing HOT 2
- Inline image example should have img tag in html input HOT 1
- events.ClientInfo is missing the `bot` field HOT 2
- Add 'web_scheme' as a primary attribute to Domain HOT 3
- Set preferred reply method for mailing lists missing HOT 1
- [Feature Request] Add Send Time Optimization (STO) Feature HOT 3
- Ability to add multiple webhooks for same events.
- panic: runtime error: invalid memory address or nil pointer dereference On GetStoredAttachment
- GetMailingList returns empty struct even though address is present HOT 4
- SDK doesn't return errors for email send failures
- Remove dependency on github.com/go-chi/chi/v5 (again)
- Incorrect use of strconv.Unquote in messages.go
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mailgun-go.