{"action":"created","issue":{"url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/3342","repository_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate","labels_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/3342/labels{/name}","comments_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/3342/comments","events_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/3342/events","html_url":"https://github.com/aspnetboilerplate/aspnetboilerplate/issues/3342","id":321478748,"node_id":"MDU6SXNzdWUzMjE0Nzg3NDg=","number":3342,"title":"Documentation on Social integrations","user":{"login":"Worthy7","id":4762399,"node_id":"MDQ6VXNlcjQ3NjIzOTk=","avatar_url":"https://avatars3.githubusercontent.com/u/4762399?v=4","gravatar_id":"","url":"https://api.github.com/users/Worthy7","html_url":"https://github.com/Worthy7","followers_url":"https://api.github.com/users/Worthy7/followers","following_url":"https://api.github.com/users/Worthy7/following{/other_user}","gists_url":"https://api.github.com/users/Worthy7/gists{/gist_id}","starred_url":"https://api.github.com/users/Worthy7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Worthy7/subscriptions","organizations_url":"https://api.github.com/users/Worthy7/orgs","repos_url":"https://api.github.com/users/Worthy7/repos","events_url":"https://api.github.com/users/Worthy7/events{/privacy}","received_events_url":"https://api.github.com/users/Worthy7/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":25,"created_at":"2018-05-09T08:32:55Z","updated_at":"2018-10-17T21:07:46Z","closed_at":"2018-10-04T13:26:00Z","author_association":"NONE","body":"For the later versions of ABP, devs are being advised to use Microsofts way for using social integrations.\r\nBut this method ties in with DotNet Identity  which ABP doesn't use. So it's very difficult to use the tutorial to get ABP working with these integrations.\r\n\r\nPlease write up a more detailed example of how to do this using at least one of the providers (Google etc).\r\nAn idea for the structure:\r\n1) User clicks here, JS authenticate and get the AuthCode, pass AuthCode to server\r\n2) Use AuthCode to get profile details, then create a new user, and (save the token?)\r\n\r\nBecause we need to keep track of the expiriry date, I am not sure if we should be using AbpUserTokens or creating our own table."},"comment":{"url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/comments/430790213","html_url":"https://github.com/aspnetboilerplate/aspnetboilerplate/issues/3342#issuecomment-430790213","issue_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/3342","id":430790213,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMDc5MDIxMw==","user":{"login":"periface","id":8449812,"node_id":"MDQ6VXNlcjg0NDk4MTI=","avatar_url":"https://avatars1.githubusercontent.com/u/8449812?v=4","gravatar_id":"","url":"https://api.github.com/users/periface","html_url":"https://github.com/periface","followers_url":"https://api.github.com/users/periface/followers","following_url":"https://api.github.com/users/periface/following{/other_user}","gists_url":"https://api.github.com/users/periface/gists{/gist_id}","starred_url":"https://api.github.com/users/periface/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/periface/subscriptions","organizations_url":"https://api.github.com/users/periface/orgs","repos_url":"https://api.github.com/users/periface/repos","events_url":"https://api.github.com/users/periface/events{/privacy}","received_events_url":"https://api.github.com/users/periface/received_events","type":"User","site_admin":false},"created_at":"2018-10-17T21:07:46Z","updated_at":"2018-10-17T21:07:46Z","author_association":"CONTRIBUTOR","body":"Hi, i noticed that this issue is closed but i was thinking about looking for a simpler way to approach the idea of social logins, in my case i wanted to use facebook, so this is what i did:\r\n\r\n### CLIENT SIDE\r\n\r\nFirst of all i wanted to handle the facebook login with an external library:\r\n[https://www.npmjs.com/package/ngx-facebook](https://www.npmjs.com/package/ngx-facebook)\r\n(Yes im a lazy guy...)\r\nI followed the instructions of the package readme, and modified the **login.service.ts** file in my angular project as follows:\r\n\r\n![image](https://user-images.githubusercontent.com/8449812/47114939-c6278580-d222-11e8-8569-2921f3775e86.png)\r\n\r\nThen i created an async function called **loginFb**, which will be responsible for the entire login process\r\n\r\n![image](https://user-images.githubusercontent.com/8449812/47115032-071f9a00-d223-11e8-8dff-70082216d105.png)\r\n\r\nAs you can see i extended the **ExternalAuthenticateModel** in my visual studio project adding some new properties\r\n\r\n![image](https://user-images.githubusercontent.com/8449812/47115102-2caca380-d223-11e8-9998-d53f5c0a58a9.png)\r\n\r\nSo, in the next step i call the **ExternalAuthenticate** method from the **_tokenAuthService** and when the result is successful i just proceed as normal.\r\n\r\nAnd finally on my **LoginComponent** i just added a button calling the method\r\n\r\n![image](https://user-images.githubusercontent.com/8449812/47115348-f6235880-d223-11e8-8921-e922c2c3fd25.png)\r\n\r\n\r\n### SERVER SIDE\r\n\r\nIn the server side i followed the instructions of the [Facebook external login setup](https://docs.microsoft.com/en-us/aspnet/core/security/authentication/social/facebook-logins?view=aspnetcore-2.1&tabs=aspnetcore2x)\r\n\r\nNext i modified the **ExternalAuthenticate** method in the `TokenAuthController.cs` file in the **Web.Core** project as follows\r\n\r\n![image](https://user-images.githubusercontent.com/8449812/47115606-b1e48800-d224-11e8-9d63-06fd2789b563.png)\r\n\r\nSo as you can see i use the **UseAbp** flag to switch functions, the important one in this case is **PerformExternalLogin**, which do exactly the same as the default implementations with just one or two differences.\r\n\r\n![image](https://user-images.githubusercontent.com/8449812/47115780-3cc58280-d225-11e8-9292-52851618b93c.png)\r\n\r\n- The **GetExternalUserInfo** function was removed\r\n\r\n- And in the **AbpLoginResultType.UnknownExternalLogin** case i added this\r\n\r\n![image](https://user-images.githubusercontent.com/8449812/47115867-8615d200-d225-11e8-8cd5-28457c43d128.png)\r\n\r\nAs i mentioned before i extended the **ExternalAuthenticateModel** with the required properties for this to work. \r\n\r\nAnd that´s it, it works for me, for Facebook at least :P ... \r\n\r\nI dont know if this is a good practice but i hope this helps someone,\r\nin any case here is a gist if you wanna see how i did it\r\n\r\n[https://gist.github.com/periface/ad4ebc968ad65ec7c6b7d40050c0012b](https://gist.github.com/periface/ad4ebc968ad65ec7c6b7d40050c0012b)\r\n\r\n### PD: SORRY FOR MY BAD ENGLISH :/"}}
{"actor":{"display_login":"periface"}}