Giter Club home page Giter Club logo

Comments (13)

thrawn01 avatar thrawn01 commented on August 21, 2024 1

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)
screenshot 2017-01-18 10 20 32

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.

alexsasharegan avatar alexsasharegan commented on August 21, 2024 1

Got it. I think.

from mailgun-go.

mbanzon avatar mbanzon commented on August 21, 2024

@boivie that seems like a good idea - the dual keys seem to cause some confusion.

from mailgun-go.

bryancallahan avatar bryancallahan commented on August 21, 2024

Would really appreciate this. Ran into some confusion myself just yesterday. 👍

from mailgun-go.

javiermanzano avatar javiermanzano commented on August 21, 2024

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.

nikgibbens avatar nikgibbens commented on August 21, 2024

I have created a pull request to fix the documentation.
mailgun/documentation#355

from mailgun-go.

alexsasharegan avatar alexsasharegan commented on August 21, 2024

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.

thrawn01 avatar thrawn01 commented on August 21, 2024

@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.

alexsasharegan avatar alexsasharegan commented on August 21, 2024

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:

image

from mailgun-go.

thrawn01 avatar thrawn01 commented on August 21, 2024

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.

alexsasharegan avatar alexsasharegan commented on August 21, 2024

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.

thrawn01 avatar thrawn01 commented on August 21, 2024

@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.

thrawn01 avatar thrawn01 commented on August 21, 2024

This might come up again, but until then I'm closing this.

from mailgun-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.