AuthSession.startAsync not working after SDK33 upgrade

Hi there. I’m using Expo with AWS Amplify & Cognito for authentication, including social logins via Google and Facebook. Everything was working fine on SDK32, but after upgrading to SDK33 (thanks for all the hard work on this!) I’m getting an “invalid_request” warning and the auth is failing when trying to use Google/Facebook social login. The auth seems to happen but fails when being handed back to Expo.

I’ve double-checked by downgrading to SDK32 and the auth flow works, then back to SDK33 and it doesn’t. Thoughts?

Hi @checkthelevel!

Sorry you’re running into this- is it in the Expo client app, or standalone? And is this on iOS, Android, or both?

Hey @charliecruzan! This is happening on Expo client app on both Android and iOS (latest version of Expo client and CLI, just fyi). I’m in the middle of testing it on standalone now so will report back on those.

Any ideas on a fix in the meantime? Thanks!

We had a few issues reported of this, and fixes were pushed out (but as far as I know, those issues only occurred on Android)

Could you share the error message you’re getting?

Digging through the issue, it seems like the request goes through properly but then is mishandled by AWS Amplify, not AuthSession. This happened after an upgrade to SDK33 but sounds like it’s due to RN >= 0.59.0 which is part of the SDK33 upgrade, not Expo specifically (Cognito hosted UI federatedSignIn not working with react native:- "Error in cognito hosted auth response Error: invalid_request" · Issue #3399 · aws-amplify/amplify-js · GitHub). Which would make sense that downgrading to SDK32 gets rid of the issue.

Is there a reverse of the expo codemod that helped with the SDK33 imports? I’ll need to go back to SDK32 to get rid of this issue for now. Thanks for your help @charliecruzan!

Oh wow, thanks for doing that digging @checkthelevel!

Unfortunately there’s no way to automatically reverse the code mod :frowning_face: (I think your best bet is git revert)

No worries! Hopefully someone else finds the info useful. If anyone is interested, I also came across what the actual issue is in RN >= 0.59.0 (Facebook login using withOAuth() always failed in React-Native · Issue #3247 · aws-amplify/amplify-js · GitHub). Seems that they messed with the global variable URLSearchParams so the redirect URL comes back improperly formatted.

1 Like

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