Authentication Social Signup succeeds only on seconds request

Hi,
am not sure whether this is new or not (most likely new as during development phase we’d have noticed that), but when social (Gmail / Github) signup is used the first request (after the chain of auth → G → auth/login → auth/resume → myapp chain of requests) results in following URL:

http://myapp:3000/#error=access_denied&error_description=The%20first%20argument%20must%20be%20of%20type%20string%20or%20an%20instance%20of%20Buffer%20or%20Uint8Array.%20Received%20an%20instance%20of%20Object

which translated into:

The first argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of Object

(I can see new user account in auth0)

…while the second click on same social method signup successfully finishes the flow.

What is it related to? How to solve it?
Please advise

What I’ve noticed is when I disable some of my Auth pipeline rules I get it working, have tried multiple variations of enabled rules, it fails once more than 4 rules are enabled (in different combinations, none single rule leads to mentioned above situation specifically, only when >4 are enabled simultaneously).
Is there a limit on rules I’m not aware of that causes this?
Still trying to fix it by trial & error but so far nothing makes sense to me.
Any help appreciated

Answering my own question. It was triggered by bad HTTP request implementation:

            request.get(
            {
                url: 'https://example.com,
                body: {
                    data: Buffer.from(JSON.stringify({ foo: 'bar' })).toString('base64'),
                },
            }

can you spot the problem?

the problem is HTTP GET request has query parameters rather than BODY, so the fix was:

            request.get(
            {
                url: 'https://example.com,
                qs: {
                    data: Buffer.from(JSON.stringify({ foo: 'bar' })).toString('base64'),
                },
            }

Hope that helps!

1 Like

Glad you figured it out and thanks for sharing with the rest of community!

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.