The user clicks on a button in Bubble and it open Nylas, they select the provider (google, Microsoft etc) and confirm the application and this redirects back to my app and in the url param it has a ‘code’ - this is to be sent back to Naylas to get the user TOKEN that will give you access.
You cannot have the authorization header in the Bubble auth part if you are doing the authorization_code flow manually like you have to exchange token. You need to
A) set everything manually or
B) use user-agent authentication and set everything you need there. This is not always possible depending of the API
Also, if you are only trying to connect your own account, check if there’s another authentication flow available for server-to-server like client_credentials. According to that: Nylas API v3 Administration docs | Nylas Docs seem that you can create an API key from dashboard and use this instead.
Thanks for the tips @Jici , I am going to need to authenticate different users email, calendars.
Figured it out, I’ll post some other details once I have confirmed explicitly.
Needed to modify the header, and an access “code” expired even when an error is received in the request… so every single time you need to get a new code.
Seems to work well using Nylas hosted auth flow on v3 of the api using bubbles api connector.
Ive setup the return url in the nylas dashboard to be a bubble api endpoint to capture the ‘code’ and then run another api flow for exchanging for the auth token, saved against the user (all hidden from the user).
The user clicks connect and this opens the Nylas hosted flow to pick the email provider and this redirects back to the bubble app where the backend wf sends (302 redirect) to the starting page (with button).
Now i can use the api and token on each users data to send email, read, calendar etc.
One think to remember when connecting in the api connector, the token invalidates even on error. So every change youll have to start the flow to get a code or youll pull your hair out trying to figure out what you broke.
Am I right in thinking Nylas can be used to allow your app users to connect their email accounts so you can send email on their behalf? Looking at the pricing, it looks like its $4.99 per account until enterprise. Is this being misinterpreted by myself?
Hey @stuart4 any way you might take a couple of minutes and bullet out what you had to do with the API Connector and any backend workflows to make that authentication work?
@olaidemuheeb I will see if i can create a video on the subject, its quite complicated and time consuming( sp i cant promise it will be soon). I belive @chris.williamson1996 has a plugin that does this for you out of the box (im unsure if its public).
With @stuart4 help to expedite the plug-in build I did create one, it is current private however, I am aiming to release it public in coming weeks if it’s needed by people.