{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/AspNetKatana/issues/48","repository_url":"https://api.github.com/repos/aspnet/AspNetKatana","labels_url":"https://api.github.com/repos/aspnet/AspNetKatana/issues/48/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/AspNetKatana/issues/48/comments","events_url":"https://api.github.com/repos/aspnet/AspNetKatana/issues/48/events","html_url":"https://github.com/aspnet/AspNetKatana/issues/48","id":220379631,"number":48,"title":"Microsoft account with MicrosoftAccountAuthenticationOptions does not seem to work","user":{"login":"YovavGad","id":11033304,"avatar_url":"https://avatars3.githubusercontent.com/u/11033304?v=3","gravatar_id":"","url":"https://api.github.com/users/YovavGad","html_url":"https://github.com/YovavGad","followers_url":"https://api.github.com/users/YovavGad/followers","following_url":"https://api.github.com/users/YovavGad/following{/other_user}","gists_url":"https://api.github.com/users/YovavGad/gists{/gist_id}","starred_url":"https://api.github.com/users/YovavGad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YovavGad/subscriptions","organizations_url":"https://api.github.com/users/YovavGad/orgs","repos_url":"https://api.github.com/users/YovavGad/repos","events_url":"https://api.github.com/users/YovavGad/events{/privacy}","received_events_url":"https://api.github.com/users/YovavGad/received_events","type":"User","site_admin":false},"labels":[{"id":534558983,"url":"https://api.github.com/repos/aspnet/AspNetKatana/labels/bug","name":"bug","color":"ee0701","default":true}],"state":"open","locked":false,"assignee":{"login":"Tratcher","id":1821173,"avatar_url":"https://avatars0.githubusercontent.com/u/1821173?v=3","gravatar_id":"","url":"https://api.github.com/users/Tratcher","html_url":"https://github.com/Tratcher","followers_url":"https://api.github.com/users/Tratcher/followers","following_url":"https://api.github.com/users/Tratcher/following{/other_user}","gists_url":"https://api.github.com/users/Tratcher/gists{/gist_id}","starred_url":"https://api.github.com/users/Tratcher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tratcher/subscriptions","organizations_url":"https://api.github.com/users/Tratcher/orgs","repos_url":"https://api.github.com/users/Tratcher/repos","events_url":"https://api.github.com/users/Tratcher/events{/privacy}","received_events_url":"https://api.github.com/users/Tratcher/received_events","type":"User","site_admin":false},"assignees":[{"login":"Tratcher","id":1821173,"avatar_url":"https://avatars0.githubusercontent.com/u/1821173?v=3","gravatar_id":"","url":"https://api.github.com/users/Tratcher","html_url":"https://github.com/Tratcher","followers_url":"https://api.github.com/users/Tratcher/followers","following_url":"https://api.github.com/users/Tratcher/following{/other_user}","gists_url":"https://api.github.com/users/Tratcher/gists{/gist_id}","starred_url":"https://api.github.com/users/Tratcher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tratcher/subscriptions","organizations_url":"https://api.github.com/users/Tratcher/orgs","repos_url":"https://api.github.com/users/Tratcher/repos","events_url":"https://api.github.com/users/Tratcher/events{/privacy}","received_events_url":"https://api.github.com/users/Tratcher/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/aspnet/AspNetKatana/milestones/1","html_url":"https://github.com/aspnet/AspNetKatana/milestone/1","labels_url":"https://api.github.com/repos/aspnet/AspNetKatana/milestones/1/labels","id":2310126,"number":1,"title":"4.0.0-alpha1","description":null,"creator":{"login":"Tratcher","id":1821173,"avatar_url":"https://avatars0.githubusercontent.com/u/1821173?v=3","gravatar_id":"","url":"https://api.github.com/users/Tratcher","html_url":"https://github.com/Tratcher","followers_url":"https://api.github.com/users/Tratcher/followers","following_url":"https://api.github.com/users/Tratcher/following{/other_user}","gists_url":"https://api.github.com/users/Tratcher/gists{/gist_id}","starred_url":"https://api.github.com/users/Tratcher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tratcher/subscriptions","organizations_url":"https://api.github.com/users/Tratcher/orgs","repos_url":"https://api.github.com/users/Tratcher/repos","events_url":"https://api.github.com/users/Tratcher/events{/privacy}","received_events_url":"https://api.github.com/users/Tratcher/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":13,"state":"open","created_at":"2017-02-08T18:09:01Z","updated_at":"2017-04-11T21:27:15Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2017-04-08T06:21:30Z","updated_at":"2017-04-14T13:22:46Z","closed_at":null,"body":"I understand Microsoft updated their APIs recently, I created a new app at https://apps.dev.microsoft.com\r\n\r\n> Application Id: 388e0946-5fa0-4143-8e7a-97141200f6a6\r\n> Password: obu****************************\r\n> \r\n> Platforms: Web\r\n> Allow Implicit Flow: YES\r\n> Redirect URIs:\r\n> https://localhost:44300/signin-microsoft\r\n> https://ufotoday.com/signin-microsoft\r\n> \r\n> Microsoft Graph Permissions: User.Read\r\n> Application Permissions: Profile\r\n> \r\n> I did not use \"generate new key pair\" (not sure what is it for)\r\n\r\nI know that before it was not possible to test on localhost, this is tested live on UFOToday.com, but I keep getting \"access denied\",\r\n\r\nresponse_type=code seems suspicious, I would think code maybe replaced with something else (not sure) see https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-scopes#using-permissions\r\n\r\nI noticed that the name of the scope changed from wl.emails wl.birthday, so I'm just trying with what I saw in the example code \"openid email profile\" (otherwise it's breaking)\r\n\r\nMy code:\r\n```\r\n// https://account.live.com/developers/applications\r\n// https://docs.microsoft.com/en-us/aspnet/core/security/authentication/social/microsoft-logins\r\n\r\nvar microsoftAuthOptions = new MicrosoftAccountAuthenticationOptions();\r\nmicrosoftAuthOptions.ClientId = currentPortalProviders.MicrosoftLiveClientId;\r\nmicrosoftAuthOptions.ClientSecret = currentPortalProviders.MicrosoftLiveClientSecret;\r\nmicrosoftAuthOptions.CallbackPath = new PathString(\"/signin-microsoft\");\r\n\r\n// See https://azure.microsoft.com/documentation/articles/active-directory-v2-scopes/\r\nmicrosoftAuthOptions.Scope.Add(\"openid\");\r\nmicrosoftAuthOptions.Scope.Add(\"email\");\r\nmicrosoftAuthOptions.Scope.Add(\"profile\");\r\n\r\nmicrosoftAuthOptions.Provider = new MicrosoftAccountAuthenticationProvider()\r\n{\r\n    OnAuthenticated = (context) =>\r\n    {\r\n        context.Identity.AddClaim(new Claim(\"urn:microsoft:access_token\", context.AccessToken));\r\n\r\n        var expiryDuration = context.ExpiresIn ?? new TimeSpan();\r\n        context.Identity.AddClaim(new Claim(\"urn:microsoft:expires_in\", DateTime.UtcNow.Add(expiryDuration).ToString(CultureInfo.InvariantCulture)));\r\n\r\n        if (context.Email != null) context.Identity.AddClaim(new Claim(\"urn:microsoft:email\", context.Email));\r\n        if (context.Id != null) context.Identity.AddClaim(new Claim(\"urn:microsoft:id\", context.Id));\r\n        if (context.Name != null) context.Identity.AddClaim(new Claim(\"urn:microsoft:name\", context.Name));\r\n        if (context.FirstName != null) context.Identity.AddClaim(new Claim(\"urn:microsoft:first_name\", context.FirstName));\r\n        if (context.LastName != null) context.Identity.AddClaim(new Claim(\"urn:microsoft:last_name\", context.LastName));\r\n\r\n        // Add all other available claims\r\n        foreach (var claim in context.User)\r\n        {\r\n            var claimType = string.Format(\"urn:microsoft:{0}\", claim.Key);\r\n            var claimValue = claim.Value.ToString();\r\n            if (!context.Identity.HasClaim(claimType, claimValue))\r\n                context.Identity.AddClaim(new Claim(claimType, claimValue, \"XmlSchemaString\", \"Microsoft\"));\r\n        }\r\n\r\n        return Task.FromResult(0);\r\n    }\r\n};\r\napp.UseMicrosoftAccountAuthentication(microsoftAuthOptions);\r\n\r\n```\r\n\r\nThis is what I'm getting:\r\n\r\n> Request URL:https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=388e0946-5fa0-4143-8e7a-97141200f6a6&scope=openid%20email%20profile&response_type=code&redirect_uri=https%3A%2F%2Fufotoday.com%2Fsignin-microsoft&state=-LhKxD2fwHXxpUcr5oJWrQdXxe-mOJoKhW0U4UJZE6C7y8ALp5XHyz5OgDp8EDeIoVg4jLis-bayiQ-kU0GctuaGMT3ltbNPI7oRFdB_KhExHeLsy3a3WSLOUIOKDmq8exIxuc5nzgOCyHuLxoMvdZVk7DpsQ7Pc2BGiJKJ_GpBMXtlALCtsn7BHfVrT9IjlBLe0I0z66XS_XUub4W4OYA\r\n> Request Method:GET\r\n> Status Code:200 OK\r\n> Remote Address:23.100.32.136:443\r\n> Referrer Policy:no-referrer-when-downgrade\r\n> \r\n> Request URL:https://login.live.com/oauth20_authorize.srf?client_id=388e0946-5fa0-4143-8e7a-97141200f6a6&scope=openid%20email%20profile&response_type=code&redirect_uri=https%3A%2F%2Fufotoday.com%2Fsignin-microsoft&state=-LhKxD2fwHXxpUcr5oJWrQdXxe-mOJoKhW0U4UJZE6C7y8ALp5XHyz5OgDp8EDeIoVg4jLis-bayiQ-kU0GctuaGMT3ltbNPI7oRFdB_KhExHeLsy3a3WSLOUIOKDmq8exIxuc5nzgOCyHuLxoMvdZVk7DpsQ7Pc2BGiJKJ_GpBMXtlALCtsn7BHfVrT9IjlBLe0I0z66XS_XUub4W4OYA&login_hint=yovavgad%40gmail.com&ui_locales=en-US&display=page&uaid=aedea0ead6e94294a42ad04754ced973&issuer=mso&tenant=common&msproxy=1\r\n> Request Method:GET\r\n> Status Code:302 Found\r\n> Remote Address:131.253.61.96:443\r\n> Referrer Policy:no-referrer-when-downgrade\r\n> \r\n> Request URL:https://ufotoday.com/signin-microsoft?code=Mde1a1f82-19ea-afb6-faed-6492578ef127&state=-LhKxD2fwHXxpUcr5oJWrQdXxe-mOJoKhW0U4UJZE6C7y8ALp5XHyz5OgDp8EDeIoVg4jLis-bayiQ-kU0GctuaGMT3ltbNPI7oRFdB_KhExHeLsy3a3WSLOUIOKDmq8exIxuc5nzgOCyHuLxoMvdZVk7DpsQ7Pc2BGiJKJ_GpBMXtlALCtsn7BHfVrT9IjlBLe0I0z66XS_XUub4W4OYA\r\n> Request Method:GET\r\n> Status Code:302 \r\n> Remote Address:52.183.33.89:443\r\n> Referrer Policy:no-referrer-when-downgrade\r\n> \r\n> Request URL:https://ufotoday.com/signup-connect?error=access_denied\r\n> Request Method:GET\r\n> Status Code:302 \r\n> Remote Address:52.183.33.89:443\r\n> Referrer Policy:no-referrer-when-downgrade\r\n\r\nDoes it work for anyone else?"},"comment":{"url":"https://api.github.com/repos/aspnet/AspNetKatana/issues/comments/294152700","html_url":"https://github.com/aspnet/AspNetKatana/issues/48#issuecomment-294152700","issue_url":"https://api.github.com/repos/aspnet/AspNetKatana/issues/48","id":294152700,"user":{"login":"Tratcher","id":1821173,"avatar_url":"https://avatars0.githubusercontent.com/u/1821173?v=3","gravatar_id":"","url":"https://api.github.com/users/Tratcher","html_url":"https://github.com/Tratcher","followers_url":"https://api.github.com/users/Tratcher/followers","following_url":"https://api.github.com/users/Tratcher/following{/other_user}","gists_url":"https://api.github.com/users/Tratcher/gists{/gist_id}","starred_url":"https://api.github.com/users/Tratcher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tratcher/subscriptions","organizations_url":"https://api.github.com/users/Tratcher/orgs","repos_url":"https://api.github.com/users/Tratcher/repos","events_url":"https://api.github.com/users/Tratcher/events{/privacy}","received_events_url":"https://api.github.com/users/Tratcher/received_events","type":"User","site_admin":false},"created_at":"2017-04-14T13:22:46Z","updated_at":"2017-04-14T13:22:46Z","body":"The next planned release is a 4.0 preview, I'll get this fixed by then."}}
{"actor":{"display_login":"Tratcher"}}