{"action":"created","issue":{"url":"https://api.github.com/repos/oktadeveloper/generator-jhipster-ionic/issues/46","repository_url":"https://api.github.com/repos/oktadeveloper/generator-jhipster-ionic","labels_url":"https://api.github.com/repos/oktadeveloper/generator-jhipster-ionic/issues/46/labels{/name}","comments_url":"https://api.github.com/repos/oktadeveloper/generator-jhipster-ionic/issues/46/comments","events_url":"https://api.github.com/repos/oktadeveloper/generator-jhipster-ionic/issues/46/events","html_url":"https://github.com/oktadeveloper/generator-jhipster-ionic/issues/46","id":327123723,"node_id":"MDU6SXNzdWUzMjcxMjM3MjM=","number":46,"title":"Ionic App can't login to the backend jHipster OAuth 2.0/Keycloak","user":{"login":"mfalzetta","id":6030216,"node_id":"MDQ6VXNlcjYwMzAyMTY=","avatar_url":"https://avatars1.githubusercontent.com/u/6030216?v=4","gravatar_id":"","url":"https://api.github.com/users/mfalzetta","html_url":"https://github.com/mfalzetta","followers_url":"https://api.github.com/users/mfalzetta/followers","following_url":"https://api.github.com/users/mfalzetta/following{/other_user}","gists_url":"https://api.github.com/users/mfalzetta/gists{/gist_id}","starred_url":"https://api.github.com/users/mfalzetta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mfalzetta/subscriptions","organizations_url":"https://api.github.com/users/mfalzetta/orgs","repos_url":"https://api.github.com/users/mfalzetta/repos","events_url":"https://api.github.com/users/mfalzetta/events{/privacy}","received_events_url":"https://api.github.com/users/mfalzetta/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-05-28T21:57:21Z","updated_at":"2018-10-29T14:11:43Z","closed_at":"2018-05-29T16:21:40Z","author_association":"NONE","body":"Hi,\r\n\r\nI create a jHipster web monolithic/OAuth 2.0/OIDC Keycloak application with jHipster 4.14.4 version, see attachment.\r\nAnd the application works fine.\r\n\r\nAfter i create a jHipster Ionic app basead on my web monolithic backend.\r\n\r\nAnd i cant login from ionic app.\r\n\r\nBackend dont have ResourceServerConfiguration class, and the class SecurityConfiguration have a method below:\r\n\r\n```\r\n@Override\r\n    protected void configure(HttpSecurity http) throws Exception {\r\n        http\r\n            .csrf()\r\n            .csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())\r\n        .and()\r\n            .addFilterBefore(corsFilter, CsrfFilter.class)\r\n            .exceptionHandling()\r\n            .authenticationEntryPoint(problemSupport)\r\n            .accessDeniedHandler(problemSupport)\r\n        .and()\r\n            .logout()\r\n            .logoutUrl(\"/api/logout\")\r\n            .logoutSuccessHandler(ajaxLogoutSuccessHandler())\r\n            .permitAll()\r\n        .and()\r\n            .headers()\r\n            .frameOptions()\r\n            .disable()\r\n        .and()\r\n            .authorizeRequests()\r\n            .antMatchers(\"/api/profile-info\").permitAll()\r\n            .antMatchers(\"/api/**\").authenticated()\r\n            .antMatchers(\"/management/health\").permitAll()\r\n            .antMatchers(\"/management/**\").hasAuthority(AuthoritiesConstants.ADMIN)\r\n            .antMatchers(\"/v2/api-docs/**\").permitAll()\r\n            .antMatchers(\"/swagger-resources/configuration/ui\").permitAll()\r\n            .antMatchers(\"/swagger-ui/index.html\").hasAuthority(AuthoritiesConstants.ADMIN);\r\n\r\n    }\r\n```\r\n\r\nMy Ionic app try access (in login) the endpoint: \r\nPOST http://localhost:8080/api/authenticate \r\n\r\nThe result in chrome for Ionic is: 403 (Forbidden)\r\n\r\nThe log in application is:\r\n2018-05-28 18:56:35.000 DEBUG 14454 --- [ XNIO-16 task-2] o.s.b.w.f.OrderedRequestContextFilter    : Bound request context to thread: HttpServletRequestImpl [ POST /api/authenticate ]\r\n2018-05-28 18:56:35.001  WARN 14454 --- [ XNIO-16 task-2] o.z.p.spring.web.advice.AdviceTrait      : Forbidden: Invalid CSRF Token 'null' was found on the request parameter '_csrf' or header 'X-XSRF-TOKEN'.\r\n2018-05-28 18:56:35.004  WARN 14454 --- [ XNIO-16 task-2] .m.m.a.ExceptionHandlerExceptionResolver : Resolved exception caused by Handler execution: org.springframework.security.web.csrf.InvalidCsrfTokenException: Invalid CSRF Token 'null' was found on the request parameter '_csrf' or header 'X-XSRF-TOKEN'.\r\n2018-05-28 18:56:35.004 DEBUG 14454 --- [ XNIO-16 task-2] o.s.b.w.f.OrderedRequestContextFilter    : Cleared thread-bound request context: HttpServletRequestImpl [ POST /api/authenticate ]\r\n\r\n\r\n<img width=\"1037\" alt=\"captura de tela 2018-05-28 as 15 34 20\" src=\"https://user-images.githubusercontent.com/6030216/40630321-27d96c8e-62a8-11e8-9a44-df74dfea73d7.png\">\r\n"},"comment":{"url":"https://api.github.com/repos/oktadeveloper/generator-jhipster-ionic/issues/comments/433924441","html_url":"https://github.com/oktadeveloper/generator-jhipster-ionic/issues/46#issuecomment-433924441","issue_url":"https://api.github.com/repos/oktadeveloper/generator-jhipster-ionic/issues/46","id":433924441,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMzkyNDQ0MQ==","user":{"login":"balvinder294","id":25227213,"node_id":"MDQ6VXNlcjI1MjI3MjEz","avatar_url":"https://avatars3.githubusercontent.com/u/25227213?v=4","gravatar_id":"","url":"https://api.github.com/users/balvinder294","html_url":"https://github.com/balvinder294","followers_url":"https://api.github.com/users/balvinder294/followers","following_url":"https://api.github.com/users/balvinder294/following{/other_user}","gists_url":"https://api.github.com/users/balvinder294/gists{/gist_id}","starred_url":"https://api.github.com/users/balvinder294/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/balvinder294/subscriptions","organizations_url":"https://api.github.com/users/balvinder294/orgs","repos_url":"https://api.github.com/users/balvinder294/repos","events_url":"https://api.github.com/users/balvinder294/events{/privacy}","received_events_url":"https://api.github.com/users/balvinder294/received_events","type":"User","site_admin":false},"created_at":"2018-10-29T14:11:43Z","updated_at":"2018-10-29T14:11:43Z","author_association":"NONE","body":"hey mfalzetta, i am also having the same issue, are you able to resolve. Also i have given the path of my jhipster gateway app built with UAA, but it is giving 403 error now."}}
{"actor":{"display_login":"balvinder294"}}