Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
OPAuth question.
  • Okay so I'm trying to use the Opauth in Fuel now.  I'm not 100% sure if I have to route to the function or if it should just be /account/oauth/provider.  As I have it set up right now in the account controller, and it looks just like the example, just not sure if I need to create a route or if it does it automatically.  I have tried both ways, I just get a 404 error. 

    N/M seemed to have gotten it, I failed to remove the index.php from the url with the .htaccess, so I wasn't adding the index.php/account/oauth/facebook in it. 

  • It's been a busy weekend for you. ;-)
  • This is true, you get so frustrated with a small problem, or mistake and you can't find it until you walk away and have that cup of tea.  LOL
  • Well, everything seems to be working as far as getting auth from the api service, and a callback.  But nothing get inserted into the database, as a user.  Just redirects back to the /index.php and no login or anything is done. 

    I copied the example from the docs, any ideas?
  • So when you get your callback, what is the result of

    $status = $opauth->login_or_register();

    You have noticed that the Message class used in the example is not a part of the framework?

    You should get "register" back, meaning the user isn't known locally. If this is the case, there are two options:
    1) have the user create a local account first (using the action_register example)
    2) auto-register the user

    For the second option to work, you need to enable 'auto_registration' in the opauth.php config file (don't forget to copy it to app/config first).

    If you need to be able to connect multiple providers (for example a facebook and a google account) to the same user, you need to go for option 1.
  • Yah, I have the Messages package also so the messages are fine, I set it to auto-register the user, but no data is still being inputted in the database.

    Even with the auto register enabled, it redirects me back to the register form.  The only part of the form that is filled out is the Full name, username is un-editable, and of course you have to enter the password for yourself, and the email in some cases.  But it wont submit because there is no username inputted.
  • It should not go there, unless you're running old code.

    Auto register requires a password, which obviously you don't get from your opauth provider. Current code generates a random one, creates the account, and returns "registered".

    If the info from the provider is not sufficient, it doesn't create, and returns "register".

    So you might want to upgrade Auth to 1.8/develop to get this fixed (not sure when the fix was introduced).
  • Hmmm, I will try that out.  I used the oil create app.  Will update you.
  • Okay so I have updated that, I'm now getting;

    no valid response received in the callback

    from twitter, and google.
  • HarroHarro
    Accepted Answer
    That's an OpAuth method meaning the the "opauth" variable is not present in the QUERY_STRING in the callback URL.

    (opauth.php, line 360)
  • I shall keep working away at it, not to sure whats going on there.  Call back is set on twitter and google, getting it on fb too.  I will get it just need to take a break look at it with fresh eyes LOL

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion