- Products
- Solutions
- Developers Go to DevelopersDocumentationTools & resources
- Success Stories
- Pricing
- Why Nylas
Create a Nylas application using hosted authentication and connect a Yahoo account!
The process of setting up your first sample app with authentication can be a bit daunting. If you’re trying out a set up for the first time, the easiest type of authentication Nylas offers is called hosted authentication. What we mean by hosted authentication, is that Nylas handles as much as possible for you. We will auto-detect third-party providers and management of token exchanges. This type of authentication is best for when you don’t mind including Nylas branding in your flow (you have to use our login page) and you want the process handled for you.
Together we will walk through setting up the Hosted Authentication sample application that’s available using the Python SDK (click here for the hosted-oauth repository). We’ll go over possible issues you may encounter and go through all the steps you need to take. At the end, we will do a walkthrough of what’s included in the code, which may be helpful for understanding what you’re setting up.
The set of steps we’re going to cover will include how to:
It’s a lot to get through, however at the end you’ll have a running sample application that you can use for a variety of interesting projects involving Nylas hosted authentication!
NOTE FOR MAC USERS: This is a Flask project. By default, Flask runs on localhost:5000. If you get an error where you aren’t authorized to access localhost:5000, check to be sure you don’t have Airplay Receiver turned on for your Mac. Follow these steps to check and shut it off. Airplay Receiver uses port 5000, which will cause you problems with your app if you don’t make this change.
You need to create an app in the Nylas dashboard any time you’re starting a new project. If you want to add more than one user account to your app, you can’t use the Quick Start app that Nylas provides. So we will make our own app. To do this, take the following steps:
At this point in the walkthrough, you should have created an application.
You’ll need the repository for the hosted authentication application. Grab the nylas-python repository from GitHub – https://github.com/nylas/nylas-python. Then navigate through the examples folder and into the hosted-auth folder. Let’s configure the config.py file:
To run the your first hosted authentication application, you need a way to connect via HTTPS. You can use the OAUTHLIB_INSECURE_TRANSPORT = 1 choice if you want to test with HTTP, but it’s best practice to use HTTPS. This is because it’s more secure and required in production (learn more about HTTP vs HTTPS here). Data sent using HTTP is unencrypted. Take the following steps:
You should now have ngrok set up and your callback URLs added to your application.
Now we’re ready to run the app and see hosted authentication in action! You need a yahoo email set up if you want to follow along with this section exactly.
You should now be ready to start integrating your account with Nylas using hosted authentication. Depending on what kind of account you add, you will have to take different steps. We are going over Yahoo today, future posts will show you how to walk through with Google and Microsoft email.
Now it’s time to add your email account! After you clicked Log in in the last section, based on the kind of email account you have, a different prompt appears. We’re using Yahoo, so that’s what you should see now. Let’s walk through the log in process:
9. On the Generate an app password screen, enter your application’s name and click Generate password. Make a note of it you will need it for the credentials box Nylas prompted you with.
10. You get a screen that displays your application password one time only. As a result, if you lose the password, you will have to delete the application and start over again. Thus you should save the password someplace secure. You’ll also receive instructions for how to use it. You log in with your regular account user name, but instead of your normal password, you put the password for the application you want to access with the account.
11. With the new application password, we can now go back to the Log in with Yahoo Mail screen that Nylas provided us with. Enter your application password in the provided box. If all goes well, you’ll be returned back to the Accounts screen for your Nylas application, and you will see your user account logged in. That’s it!
Not only can you integrate with Yahoo, but also Google and Microsoft. We will go over how to set those up in future posts. But for now, congrats, you’ve completed your first hosted authentication flow!
Please enter your email address and receive the latest updates.