Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No rows are inserted in oauth_identities #27

Closed
vgomes opened this issue Feb 19, 2015 · 8 comments
Closed

No rows are inserted in oauth_identities #27

vgomes opened this issue Feb 19, 2015 · 8 comments

Comments

@vgomes
Copy link

vgomes commented Feb 19, 2015

I'm using the package in laravel 5 and I'm facing an issue. I manage to be redirected to Facebook, and being redirected back to my app, and using the closure I can see the details of the user, but I cannot login normally because no info is added to the table oauth_identities.

If I manually populate a row with the required info, all the new login attepts work properly..

Is this a normal behaviour because it's something I must manually insert or the package is supposed to do that for me?

Thanks and sorry if it is a stupid question.

@adamwathan
Copy link
Owner

Hey! Not sure what the problem could be... Could you check out this walkthrough video I put together, and see what might be different about your setup vs. what I put together?

https://vimeo.com/120085196

Are you on Laravel 4 or 5?

@vgomes
Copy link
Author

vgomes commented Feb 20, 2015

I'm on laravel 5.

I've been checking my user model and it's like the default one that laravel ships.

My problem, is when I got redirected back, system performs a select in DB

select * from oauth_identities where provider = ? and provider_user_id = ? limit 1

and performs it with the data google returns, and then, tries to create the user, but with no data, because nothing is ever stored in oauth_identities

insert into users (updated_at, created_at) values (?, ?)

If I catch that exception and store that info, the systems works perfectly.
Run a composer update and problem is the same:

Installing adamwathan/eloquent-oauth (dev-laravel-5 daca55b)

@adamwathan
Copy link
Owner

What database are you using? I'm guessing the issue is you need to make the email and password columns nullable on your users table, since creating a user through this package results in a user with no credentials (of course, since they are logging in through a separate service).

The entry to oauth_identities is created after creating the users entry, because the oauth_identities table has a foreign key to the user's ID.

The first select is performed to see if the user already exists, if they don't create a new user, then save an OAuthIdentity for that new user.

@vgomes
Copy link
Author

vgomes commented Feb 20, 2015

I see, that's exactly my problem.
Thank you very much!

@vgomes vgomes closed this as completed Feb 20, 2015
@adamwathan
Copy link
Owner

No prob glad I could help! :)

@aborovkov
Copy link

Hello! I have a problem with using both linkedin and facebook for one user... db insert fails.. is it possible to solve it somehow?

@adamwathan
Copy link
Owner

You mean using LinkedIn and Facebook for the same person and trying to make it one account? That isn't supported at the moment, maybe in the future. See this issue: #19

@dipuchaudhary
Copy link

Illuminate \ Database \ QueryException (42S02)
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'laravel.oauth_identities' doesn't exist (SQL: select * from `oauth_identities` where `provider` = github and `provider_user_id` = 34309829 limit 1)
Previous exceptions
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'laravel.oauth_identities' doesn't exist (42S02)``

why i'm getting this error although i've made changes in the user table email and password as nullable.
Screenshot from 2020-05-18 17-17-04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants