nango icon indicating copy to clipboard operation
nango copied to clipboard

Add a REST endpoint that returns a url to start the auth process

Open mindtheflo opened this issue 2 years ago • 6 comments

mindtheflo avatar May 21 '24 21:05 mindtheflo

Could you please tell us more about your use-case?

A quick workaround for this is that you host a very simple web page with a button to connect, using our frontend SDK.

bastienbeurier avatar Jun 14 '24 07:06 bastienbeurier

Yes that’s what I did but : 1 - It had an extra unnecessary step. 2 - I currently can't get Nango to to work on Safari mobile

Here’s my use case:

  • My user interacts with a WhatsApp bot
  • At some point, they must give it access to their Notion.
  • The bot is running on serverless python.

What I want to be able to call the REST API with the same parameters taken by the nango.auth() function that returns the URL to redirect the user to. Example : https://www.notion.so/install-integration?response_type=code&client_id=401588b7-da90-498e-8948-XXXX&redirect_uri=https%3A%2F%2Fapi.nango.dev%2Foauth%2Fcallback&state=533f5390-2a64-11ef-8b40-XXXX&owner=user Then I can shortlink that URL to something pretty and pass it on the Whatsapp conversation.

mindtheflo avatar Jun 14 '24 15:06 mindtheflo

I understand. Unfortunately, our frontend SDK currently works in a way that would be complex to reproduce with a pure link.

It's possible, but it requires more work than we can put in now. Here are a couple examples of what we need to change:

  • Nango assumes there's WebSocket connection with the frontend to send back a success/error payload
  • The frontend SDK also takes care of closing the popup in which the login form appears, so the user knows the OAuth dace is finished
  • The frontend SDK doesn't only support OAuth, but also other auth types (Basic auth, API key, etc.) with the same nango.auth() method. So doing OAuth via a link would break this parallelism.

The best workaround is to host a very simple page which calls nango.auth(). We will most likely implement it this way anyway when we will support authorizing users via a link.

bastienbeurier avatar Jun 17 '24 07:06 bastienbeurier

Thanks for the detailed answer. I have already implemented the workaround but still have the issue with: https://github.com/NangoHQ/nango/issues/2189

mindtheflo avatar Jun 18 '24 09:06 mindtheflo

Understood, we'll look into this other issue asap.

bastienbeurier avatar Jun 18 '24 11:06 bastienbeurier