Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
parisetflorian opened this issue May 21, 2024 · 6 comments
Open
Labels

Comments

@parisetflorian
Copy link

No description provided.

Copy link

linear bot commented May 21, 2024

@parisetflorian parisetflorian changed the title Add a REST endpoint that returns a url to start the with Add a REST endpoint that returns a url to start the auth l May 21, 2024
@parisetflorian parisetflorian changed the title Add a REST endpoint that returns a url to start the auth l Add a REST endpoint that returns a url to start the auth process May 21, 2024
@linear linear bot added the GitHub label Jun 7, 2024
Copy link
Member

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.

@parisetflorian
Copy link
Author

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.

@bastienbeurier
Copy link
Member

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.

@parisetflorian
Copy link
Author

Thanks for the detailed answer.
I have already implemented the workaround but still have the issue with:
#2189

Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants