Stripe login link URL does not work

341 views
Skip to first unread message

Simpsonian ISimps

unread,
Jan 14, 2018, 4:29:03 PM1/14/18
to Stripe API Discussion

I am following the project at stripe-connect-rocketrides, and running it on my own NodeJS server to try to learn how to integrate Stripe payments. I've setup pretty much everything, but am now running into an issue where the login link doesn't work.


To start, I have a Stripe Account ID that I have created for the user who logged in and stored in the database. Now, when I try to log the user in to the Stripe Dashboard, I know that I need to use the Create Login Link API to fetch a URL from Stripe that I can redirect users to. The URL I get is: https://connect.stripe.com/express/somehash


The problem is, when I redirect users to https://connect.stripe.com/express/somehash, this is the response I get:

{
  "error": {
      "code": "unexpected_api_error",
      "message": "An unexpected error occurred",
      "type": "api_error"
  }
}

This is code in the project that redirects the users to that page:

router.get('/transfers', pilotRequired, async (req, res) => {
        const pilot = req.user;
        // Make sure the logged-in pilot had completed the Stripe onboarding.
        if (!pilot.stripeAccountId) {
             return res.redirect('/pilots/signup');
        }
       try {
           // Generate a unique login link for the associated Stripe account.
           const loginLink = await 
           stripe.accounts.createLoginLink(pilot.stripeAccountId);

           return res.redirect(loginLink.url);
       } catch (err) {
            console.log('Failed to create a Stripe login link.');
            return res.redirect('/pilots/signup');
      }
  });

I wonder if this is because the URL expired. But I always get the API error from Stripe as soon as I receive the URL. Any help would be greatly appreciated

Remi J.

unread,
Jan 14, 2018, 4:33:16 PM1/14/18
to api-d...@lists.stripe.com
Hey,

This error often happens when you're already logged into an existing (and separate) Stripe account in the dashboard but try to log into a different Express account. I'd recommend trying to use the link in a different browser first to see if it fixes the issue.

Otherwise, I would need a bit more details about this issue. Especially the exact login link URL you are getting back from the API along with the connected account's id that you're creating it for. What I'd recommend here is to reach out to our support team directly so that they can help diagnose the problem with you and look into your account and logs as needed.

You can contact them here: https://support.stripe.com/email

Best,
Remi

--
You received this message because you are subscribed to the Google Groups "Stripe API Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-discuss+unsubscribe@lists.stripe.com.
To post to this group, send email to api-d...@lists.stripe.com.
Visit this group at https://groups.google.com/a/lists.stripe.com/group/api-discuss/.

Reply all
Reply to author
Forward
0 new messages