Auth0 Home Blog Docs

Android -- Missing required parameter: code


#1

I’m getting the following response when I attempt to initiate the web authentication provider using the Android toolkit (latest version, 1.13):

Code: invalid_request
Description: Missing required parameter: code

This is after being redirected to the Auth0 login page and providing credentials. It comes up after redirection back to my app.

The toolkit is working in the sample app, so there must be something off in what I’m doing in mine. I can’t figure out what it is, though. The logic for connection is the same, I’m using the same client ID and domain, and I do have the callback set up correctly for my app. I just tested copying the Activity from the working sample app into my own, and in my own app, this error occurs. The only major difference I can think of is that my app uses a more recent Gradle plugin, and is two major versions ahead in its build tools. Any idea why this would be happening?


#2

A note: I get a warning that I’m using Auth0 development keys when I try to connect through my own app, and not with the sample app. This is despite using the exact same client ID and domain. What’s going on here?


#3

Do you have the ability to track the network calls? I would think that you are getting an error message sent somewhere, perhaps after the login. It is trying to send an error message to the callback and instead of handling the error, it is trying to exchange the code for tokens (but there is no code because of the error).

Try adding some extra debug to your callback and see if you are getting an error there instead of a code. That should point you at the underlying problem.

As for the developer tools warning. Are you using google to authenticate? If so, you can get rid of that warning by configuring your own google app keys instead of using the default Auth0 keys. See here for instructions: https://auth0.com/docs/connections/social/google


#4

Thanks for the reply. I managed to get it working by explicitly declaring the RedirectActivity in my AndroidManifest. The problem seems to have been a result of Gradle’s merge order, where the manifestPlaceholders weren’t being integrated properly. I’ll link the GitHub issue for future reference if anyone else runs into this issue: https://github.com/auth0/Auth0.Android/issues/166