#justinw

1 messages ยท Page 1 of 1 (latest)

frosty tapirBOT
keen crest
#

No, I don't think there's a way to see those requests in the dashboard at all

vale prism
#

got it

#

are you able to see it on your end somehow?

#

this is a pretty old integration that's been having these issues all of a sudden lately, and haven't found the source

#

should I DM main account id?

keen crest
#

You can share the main account ID here!

vale prism
#

kk IT8ey7sk3qyEqt8fkZnLcDhbqbqd0265

#

it's been an intermittent issue for some time

keen crest
#

๐Ÿ‘ I'll take a look

vale prism
#

thank you!!

keen crest
#

Do you happen to have a timerange when you know this bad request happened?

vale prism
#

this one in particular happened at

#

~5pm

keen crest
#

what time zone?

vale prism
#

EST

#

another at 11:58AM EST

vale prism
#

One strange detail on the auth flow is that I'm seeing that error, but my user table is populating back with an access_token -- however, on my app on the checkout flow we're seeing

#

so trying to get more error fidelity to dial in a bit

keen crest
#

Do you happen to have the account ID for that connected account? I'm having more trouble than I thought I would narrowing this down

vale prism
#

yeah 1 moment

#

acct_1N5YGAEo1TF1yIRz

keen crest
#

thanks!

#

Aha that helps a lot

vale prism
#

cool

keen crest
#

So it looks like you're accidentally the same access token twice - which automatically disconnects that connected account from the platform (and that's why you're seeing those "Expired API key provided" errors)

vale prism
#

accidentally creating?

keen crest
#

(Sorry i've been typing too fast and had to edit it)

vale prism
#

hmm isn't the authorization / bearer token for that request

#

my constant app api key?

#

(been a while since I wrote this so catching back up to speed)

keen crest
#

The authroziation header includes your (the platform's) API key

#

I'm talking about the authorization code you'd pass in with the request body

vale prism
#

got it

#

is that the source of the 400 as well?

keen crest
#

Yeah - the first request to https://connect.stripe.com/oauth/token succeeds, but the second one you make right after that is failing with a 400 (because you're reeusing the authorization code)

vale prism
#

ahhhh

#

ok thank you -- i'm going to debug a bit more on my end. Is it possible to keep this thread open ?

keen crest
#

๐Ÿ‘ I'll keep the thread open a bit longer, but we do close this channel right at 5 PM (pacific time) so I'll have to close the thread at that point

vale prism
#

ok got it

#

one thing im seeing in the logs

#

is/stripe_authorization?error=access_denied&error_description=The+user+denied+your+request

#

(/stripe_authorization is my redirect_uri)

keen crest
#

Yeah I think that's something separate - you'd get that if the to-be-connected account chose to reject the connection

vale prism
#

got it

#

potentially too specific to my application -- but the request to /oauth/token is taking place on the handler to the redirect_uri I passed into https://connect.stripe.com/oauth/authorize

    code = params[:code]
    if !code
      redirect_to raffles_path
      return
    end

    begin
      body = { :code => code, :grant_type => "authorization_code" }.to_json

      logger.info "1. TRYING CONNECTING TO STRIPE WITH CURRENT USER: #{current_user.email}"

      response = RestClient.post "https://connect.stripe.com/oauth/token", body,
      {
        :content_type => "application/json",
        :authorization => "Bearer #{ENV["STRIPE_APP_KEY"]}"
      }```
#

trying to understand how that might be getting called two times in a row

#

either Stripe is accidentally redirecting twice

#

or only other thing I could thing of is maybe I set it to an HTTP base url and the browser is redirected to an HTTPS

#

ah I am setting https on that URL

keen crest
#

It really could be anything - I doubt it would be stripe redirecting twice. It could be something as simple as a browser refresh that does it

vale prism
#

yeah maybe I should just add

#

a check to see if the user is already authed

#

just to double check my unerstanding

#

logs are showing that we ARE triggering a successful request and getting the access_token back etc

#

but then we're another request, which throws the 400, and invalidates that access_token we have saved

keen crest
#

yup that's what I'm seeing in the logs!

vale prism
#

ok sweet, im gonna add in that check

#

and hopefully that just catches the double call even if I can't find the root cause of it

keen crest
#

๐Ÿ‘

vale prism
#

massive thanks for the aid here

#

been causing me some serious pain for the last couple weeks

keen crest
#

happy to help! this used to come up a lot more when the oauth flow was more common ๐Ÿ™‚

vale prism
#

out of curiosty what's the current rec approach?

#

if not oauth

keen crest
vale prism
#

sweet swill check it out

keen crest
#

But it won't work if you're trying to conenct to existing accounts

vale prism
#

ah gotcha

#

that's a blocker

keen crest
#

yeah, that's why we still have a good chunk of people still on oauth

vale prism
#

alright thanks again! gonna push this up and head out