gmailnativeauth

command
v0.14.1-0...-14c41cf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2021 License: MIT Imports: 7 Imported by: 0

README

Example: Native Authentication (Gmail)

This is an example file that demonstrates how to connect to Nylas using the Native Authentication flow. Note that different email providers have different native authentication processes; this example project only works with Gmail.

In order to successfully run this example, you need to do the following things:

Get a client ID & client secret from Nylas

To do this, make a Nylas Developer account. You should see your client ID and client secret on the dashboard, once you've logged in on the Nylas Developer website.

Get a client ID & client secret from Google

To do this, go to the Google Developers Console and create a project. Then go to the "Library" section and enable the following APIs: "Gmail API", "Contacts API", "Google Calendar API". Then go to the "Credentials" section and create a new OAuth client ID. Select "Web application" for the application type, and click the "Create" button.

Check out the Google OAuth Setup Guide on the Nylas support website, for more information.

Update the constants in main.go

Open the main.go file int his directory and replace the constants with the values you've obtained from the steps above.

Set the Authorized Redirect URI for Google

Once you have a HTTPS URL that points to your computer, you'll need to tell Google about it. On the Google Developer Console, click on the "Credentials" section, find the OAuth client that you already created, and click on the "edit" button on the right side. There is a section called "Authorized redirect URIs"; this is where you need to tell Google about your URL.

Add http://localhost:8080

Run the Example

Finally, run the example like this:

go run main.go

Once the server is running following the instructions printed.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL