Notion API — Laravel Authentication Example

Farid Movsumov
6 min readMay 14, 2021

Notion recently released their beta API and this is very exciting for a lot of developers who were planning to create some integrations for Notion. Being first always is a huge advantage and I also already started playing with API. In this post, I will try to share my experience with API and some example authentication code written in Laravel.

Create Integration

You should first create an integration here.

After this step, you will already receive an internal integration token and you can start playing with it in your own workspace, but if you want to build some public app which I think should be the main goal then you should choose the public integration type.

After switching to public integration you will see a long form with a lot of information to feel, don’t let it scare you you can simply put some fake URLs in the beginning for most of the fields except Redirect URI, this one should be HTTPS URL, I will explain how I was able to generate SSL URL on the local environment. This part was a bit tricky because I set up my local environment with Laravel Sail (Docker) and couldn’t figure out how to make my local development URL HTTPS.

I used on local virtual host, first I set up my local Laravel with Docker by using Laravel Sail but it was challenging to use SSL for my local domain then I used Homestead (vagrant) and it was quite easy to set up my application. You can see below how my homestead.yaml file looks like.

And you should also add it to your host file. On Mac, it is /etc/hosts file. I just added the following line.

Farid Movsumov