{"action":"created","issue":{"url":"https://api.github.com/repos/benbaran/adal-angular4/issues/53","repository_url":"https://api.github.com/repos/benbaran/adal-angular4","labels_url":"https://api.github.com/repos/benbaran/adal-angular4/issues/53/labels{/name}","comments_url":"https://api.github.com/repos/benbaran/adal-angular4/issues/53/comments","events_url":"https://api.github.com/repos/benbaran/adal-angular4/issues/53/events","html_url":"https://github.com/benbaran/adal-angular4/issues/53","id":325683948,"node_id":"MDU6SXNzdWUzMjU2ODM5NDg=","number":53,"title":"Endpoint is not called by ADAL, instead only token is returned","user":{"login":"web265p3","id":20642406,"node_id":"MDQ6VXNlcjIwNjQyNDA2","avatar_url":"https://avatars2.githubusercontent.com/u/20642406?v=4","gravatar_id":"","url":"https://api.github.com/users/web265p3","html_url":"https://github.com/web265p3","followers_url":"https://api.github.com/users/web265p3/followers","following_url":"https://api.github.com/users/web265p3/following{/other_user}","gists_url":"https://api.github.com/users/web265p3/gists{/gist_id}","starred_url":"https://api.github.com/users/web265p3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/web265p3/subscriptions","organizations_url":"https://api.github.com/users/web265p3/orgs","repos_url":"https://api.github.com/users/web265p3/repos","events_url":"https://api.github.com/users/web265p3/events{/privacy}","received_events_url":"https://api.github.com/users/web265p3/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-23T12:31:44Z","updated_at":"2018-06-01T13:38:48Z","closed_at":null,"author_association":"NONE","body":"For this issue I created a new Angular6-app with angular cli, that tries to call my backend API with a token retrieved from the oauth-endpoint.\r\n\r\nMy source code can be found here:\r\nhttps://github.com/web265p3/angular-adal-test/tree/master/src\r\n\r\nI installed the latest version of adal-angular4 and configured everything like I found in the tutorials.\r\nI call my API with the following lines:\r\n\r\n        this.http\r\n        .get(`${environment.adalConfig.apiUrl}authentication3`, this.prepareOptions())\r\n        .pipe(\r\n        map((r: any) => {\r\n            return r;\r\n        })).subscribe(a => {\r\n        }, r => {\r\n        });\r\n\r\nThe prepare options, just adds the token:\r\n\r\n\r\n    prepareOptions(): any {\r\n        let httpHeaders = new HttpHeaders();\r\n        httpHeaders = httpHeaders\r\n            .set('Content-Type', 'application/json')\r\n            .set('Authorization', `Bearer ${this.adalService.userInfo.token}`);\r\n        return { headers: httpHeaders };\r\n    }\r\n\r\nBut a URL with \"authentication3\" as suffix is never even called. Instead I can find a token, that is returned to my app via an HTTP 302 redirect.\r\n\r\n> https://login.microsoftonline.com/2ef09b02-2e8f-4181-8bb2-78cfc813799a/oauth2/authorize?response_type=token&client_id=197214be-be8d-4ba1-bdb5-f231ff06bb02&resource=https%3A%2F%2Fmydomain-api.azurewebsites.net&redirect_uri=http%3A%2F%2Flocalhost%3A4200%2F&state=90a7cba4-0370-4ba4-be44-7857b9dfb5a1%7Chttps%3A%2F%2Fmydomain.azurewebsites.net&client-request-id=84e96d07-a7a9-4ec5-956b-c980d3dc1aca&x-client-SKU=Js&x-client-Ver=1.0.17&prompt=none&login_hint=user.name%40tenantname.onmicrosoft.com&domain_hint=tenantname.onmicrosoft.com\r\n\r\nThe location header redirects me to localhost:4200 with a valid access token. But ADAL does neither take the token, nor calls my endpoint. It just happens nothong. \r\n\r\nI enabled adal verbose logging and get the following output:\r\n\r\n\r\n> Wed, 23 May 2018 12:07:08 GMT:1.0.17-INFO: renewToken is called for resource:https://mydomain-api.azurewebsites.net\r\n> app.component.ts:21 Wed, 23 May 2018 12:07:08 GMT:1.0.17-INFO: Add adal frame to document:adalRenewFramehttps://mydomain.azurewebsites.net\r\n> app.component.ts:21 Wed, 23 May 2018 12:07:08 GMT:1.0.17-VERBOSE: Renew token Expected state: 90a7cba4-0370-4ba4-be44-7857b9dfb5a1|https://mydomain.azurewebsites.net\r\n> app.component.ts:21 Wed, 23 May 2018 12:07:08 GMT:1.0.17-INFO: Navigate url:https://login.microsoftonline.com/2ef09b02-2e8f-4181-8bb2-78cfc813799a/oaut…d=84e96d07-a7a9-4ec5-956b-c980d3dc1aca&x-client-SKU=Js&x-client-Ver=1.0.17\r\n> app.component.ts:21 Wed, 23 May 2018 12:07:08 GMT:1.0.17-VERBOSE: Set loading state to pending for: https://mydomain.azurewebsites.net\r\n> app.component.ts:21 Wed, 23 May 2018 12:07:08 GMT:1.0.17-INFO: LoadFrame: adalRenewFramehttps://mydomain.azurewebsites.net\r\n> app.component.ts:21 Wed, 23 May 2018 12:07:09 GMT:1.0.17-INFO: Add adal frame to document:adalRenewFramehttps://mydomain.azurewebsites.net\r\n> app.component.ts:21 Wed, 23 May 2018 12:07:09 GMT:1.0.17-INFO: LoadFrame: adalRenewFramehttps://mydomain.azurewebsites.net\r\n> app.component.ts:21 Wed, 23 May 2018 12:07:09 GMT:1.0.17-INFO: Add adal frame to document:adalRenewFramehttps://mydomain.azurewebsites.net\r\n> app.component.ts:21 Wed, 23 May 2018 12:07:12 GMT:1.0.17-VERBOSE: State: 90a7cba4-0370-4ba4-be44-7857b9dfb5a1|https://mydomain.azurewebsites.net\r\n> app.component.ts:21 Wed, 23 May 2018 12:07:12 GMT:1.0.17-INFO: State status:false; Request type:LOGIN\r\n> \r\n\r\nI am out of ideas, what might go wrong here. Why is ADAL just ignoring my call to the \"authentication3\" route. Any proposals?"},"comment":{"url":"https://api.github.com/repos/benbaran/adal-angular4/issues/comments/393883404","html_url":"https://github.com/benbaran/adal-angular4/issues/53#issuecomment-393883404","issue_url":"https://api.github.com/repos/benbaran/adal-angular4/issues/53","id":393883404,"node_id":"MDEyOklzc3VlQ29tbWVudDM5Mzg4MzQwNA==","user":{"login":"web265p3","id":20642406,"node_id":"MDQ6VXNlcjIwNjQyNDA2","avatar_url":"https://avatars2.githubusercontent.com/u/20642406?v=4","gravatar_id":"","url":"https://api.github.com/users/web265p3","html_url":"https://github.com/web265p3","followers_url":"https://api.github.com/users/web265p3/followers","following_url":"https://api.github.com/users/web265p3/following{/other_user}","gists_url":"https://api.github.com/users/web265p3/gists{/gist_id}","starred_url":"https://api.github.com/users/web265p3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/web265p3/subscriptions","organizations_url":"https://api.github.com/users/web265p3/orgs","repos_url":"https://api.github.com/users/web265p3/repos","events_url":"https://api.github.com/users/web265p3/events{/privacy}","received_events_url":"https://api.github.com/users/web265p3/received_events","type":"User","site_admin":false},"created_at":"2018-06-01T13:38:48Z","updated_at":"2018-06-01T13:38:48Z","author_association":"NONE","body":"Problem fixed!\r\nThis issue describes what was wrong. It was the adal version 1.0.17, that contained a bug. \r\n\r\nhttps://github.com/benbaran/adal-angular4/issues/32"}}
{"actor":{"display_login":"web265p3"}}