{"action":"opened","issue":{"url":"https://api.github.com/repos/thephpleague/oauth2-server/issues/324","labels_url":"https://api.github.com/repos/thephpleague/oauth2-server/issues/324/labels{/name}","comments_url":"https://api.github.com/repos/thephpleague/oauth2-server/issues/324/comments","events_url":"https://api.github.com/repos/thephpleague/oauth2-server/issues/324/events","html_url":"https://github.com/thephpleague/oauth2-server/issues/324","id":63635085,"number":324,"title":"newAuthorizeRequest not inserting to oauth_sessions table","user":{"login":"juworld","id":4934557,"avatar_url":"https://avatars.githubusercontent.com/u/4934557?v=3","gravatar_id":"","url":"https://api.github.com/users/juworld","html_url":"https://github.com/juworld","followers_url":"https://api.github.com/users/juworld/followers","following_url":"https://api.github.com/users/juworld/following{/other_user}","gists_url":"https://api.github.com/users/juworld/gists{/gist_id}","starred_url":"https://api.github.com/users/juworld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juworld/subscriptions","organizations_url":"https://api.github.com/users/juworld/orgs","repos_url":"https://api.github.com/users/juworld/repos","events_url":"https://api.github.com/users/juworld/events{/privacy}","received_events_url":"https://api.github.com/users/juworld/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-23T06:09:31Z","updated_at":"2015-03-23T06:09:31Z","closed_at":null,"body":"First, I want to thank you for the awesome library.\r\n\r\nI just have this one issue that I can't figure out. My `newAuthorizeRequest` not inserting to correctly into `oauth_sessions` table.\r\n\r\nWhen I passed in my $params by calling newAuthorizeReuqest\r\n\r\n```php\r\n$code = $this->authserver->getGrantType('authorization_code')->newAuthorizeRequest('user',  $user['id'], $params);\r\n```\r\n\r\nI get this sql error:\r\n```\r\nSQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`test`.`oauth_sessions`, CONSTRAINT `oauth_sessions_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `oauth_clients` (`id`) ON DELETE CASCADE) (SQL: insert into `oauth_sessions` (`owner_type`, `owner_id`, `client_id`) values (user, 1, 1))\r\n```\r\n\r\nThis is because the `id` from `oauth_client_redirect_uris` table is being used to passed into `oauth_sessions` as `client_id`\r\n\r\nWhat I did to make this work is by changing the `oauth_client_redirect_uris` table as such\r\n![image](https://cloud.githubusercontent.com/assets/4934557/6774540/1464f126-d15d-11e4-87b3-cc6523c0a851.png)\r\n\r\nBut, I'm 100% sure that I'm not doing this right some how. Please advice.\r\n\r\nJustin"}}