Help in Adonis social Authentication


Hello Im following the authentication tutorial of the oficial documentation, but I have the following error, any idea? thanks

E_UNDEFINED_METHOD: Method redirect missing on App/Controllers/Http/LoginController > More details: 

Yes I have the method declared inside the controller, the keys of facebook declared


I didn’t use a controller, but this works successfully for me.

Route.get('facebook', async ({ ally }) => {
  await ally.driver('facebook').redirect()

Route.get('/auth/facebook', async ({ ally, response }) => {
  let user = await ally.driver('facebook').getUser()



Here it is in a controller. (works well here too)

class LoginController {
  async redirect ({ ally }) {
    await ally.driver('facebook').redirect()

  async callback ({ ally, response }) {
    let user = await ally.driver('facebook').getUser()


What does your routes file look like?


these are my routes

Route.get(‘login/facebook’, ‘LoginController.redirect’)
Route.get(‘facebook/callback’, ‘LoginController.callback’)


And there is no typo in your controller action name, correct?


No man, in fact Im following the tutoriasl provided by the official documentation but im not sure what’s the problem :smiley:


Do you mind sharing the project? I can try to spin it up on my machine.


yeah thanks give a minutes


With your help I already have not the same error, but now i hvae this one

“error”: {
“message”: “redirect_uri isn’t an absolute URI. Check RFC 3986.”,
“type”: “OAuthException”,
“code”: 191,
“fbtrace_id”: “CDgzLNLJ8Uy”


Hmm are you using localhost as the facebook url?


yeah im using it


Ok that’s the problem. Think about it at facebook they also have servers so calling localhost will resolve to their internal machines.

To get around this use something like ngrok.

Install via npm npm install ngrok -g or
If you have homebrew use brew cask install ngrok

Then run ngrok http 3333 from your adonis project. This will create a tunnel directly to your machine


oh my God i didn’t know let my try your idea many thanks for your time


what was the solution for the first error???