Authenticate Medium Users Using the Unofficial Medium API

Be confident that your users actually own the Medium accounts they claim


As a platform owner, you know the importance of authenticating your users to ensure their validity and claims on your site. Unfortunately, Medium does not provide any native authentication method for third-party websites, like Google or Facebook do via OAuth2. This leaves platform owners with the challenge of finding alternative ways to authenticate their users.

One solution is to use the Unofficial Medium API and its single auth endpoint to authenticate users.

By following a four-step methodology, you can effectively verify the authenticity of Medium accounts on your platform.

In this article, we will outline this methodology and show you how to authenticate your Medium users. So, if you want to ensure that your users are who they claim to be, this is the best method available.

So, without further ado, let's dive into the details.


Authentication Flow

Here is a four-step methodology for authenticating Medium users on your platform:

1. When a new writer registers on your platform, assign them a unique user ID. This will be used to identify and keep track of the user on your platform.

2. Next, ask the writer to publish a short article with a certain tag on their Medium account. This tag will be used to verify the authenticity of the user later on.

3. Once the article has been published, ask the writer to provide their "Medium username" on your front end. This will tell you their Medium account, and you can verify their authenticity corresponding to that.

4. Lastly, on the backend, hit the endpoint (mentioned below), which checks the writer's top 25 articles. If any of these articles have the tag you specified earlier, the user is authenticated, and you can associate their "Medium username" with their unique user ID in your database. This way, you can be confident that the user actually owns the Medium account they claim.


The Auth Endpoint

POST /verify

Example command and output

Our authentication endpoint is designed to verify the authenticity of a Medium user's account. It takes a POST request with a JSON body containing the user's Medium username and the verification_tag used to authenticate the user.

Upon receiving the request, the endpoint accesses the user's top 25 articles on Medium and searches for any articles that contain the verification tag. If a match is found, the endpoint returns a JSON response with a boolean flag called "is_authenticated" set to true.

All of this is done within a second!

In addition to the "is_authenticated" flag, the JSON response also includes the URL and ID of the article where the match was found, as well as all the tags associated with that article. This information can be used to manually verify the authenticity of the user.

Curl Command

Overall, the authentication endpoint is a simple and effective way to verify the authenticity of Medium users on your platform. So, it is a very useful tool for any platform owner looking to authenticate their users through their Medium accounts and wants to ensure that their user actually owns that Medium account that they claim.


Benefits and Use-cases

Once you onboard your users, take the required permissions and authenticate their corresponding Medium accounts, you can enjoy the following benefits:

Basically, you can get all the data related to them and perform analytics, gather insights, and use it in your platform, as per your requirements. There are no limitations.

You can tell us what data points you want for your specific business need, and we can build a custom endpoint for that.


How can you use it in your own application?

In the above-mentioned example, I ran the server on my local machine (http://0.0.0.0:8000), but if you want to integrate this service into your platform, email me at "nishu@mediumapi.com" ✉️.

I'll host this service for you and send you a public URL which you can use on your backend. 🚀

And along with the Auth Endpoint, I'll also provide custom endpoints, tailored to your requirement, to help you fetch data from Medium. 🏗 ️

So what are you waiting for ... Drop me an email and let's have a chat!


Related Stories -