Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oauth2, Separate Backend and Frontend - Request method 'POST' not supported #27355

Closed
1 task done
nury-garryyev opened this issue Sep 22, 2024 · 1 comment
Closed
1 task done

Comments

@nury-garryyev
Copy link

Overview of the issue

I have created the hipster app with a backend and frontend separate from the commands below. After successfully starting the backend and frontend and trying the login, I get the "Request method 'POST' not supported" in the backend logs.

jhipster --skip-client
jhipster jdl jhipster.jdl
docker-compose -f src/main/docker/keycloak.yml up
docker-compose -f src/main/docker/postgresql.yml up

jhipster --skip-server --auth=oauth2 --db=postgresql
jhipster jdl jhipster.jdl

Motivation for or Use Case

I have checked the source code in the frontend side and the request is made with the POST method, where the backend expects GET method.

I think that when the jhipster app is created with a separate back and front and with oauth2 support, it does not create the source code properly.

Reproduce the error

jhipster --skip-client
jhipster jdl jhipster.jdl
docker-compose -f src/main/docker/keycloak.yml up
docker-compose -f src/main/docker/postgresql.yml up

jhipster --skip-server --auth=oauth2 --db=postgresql
jhipster jdl jhipster.jdl

Related issues

#21079

Suggest a Fix

no suggestion

JHipster Version(s)

v8.7.0

JHipster configuration
.yo-rc.json file
{
  "generator-jhipster": {
    "applicationType": "monolith",
    "authenticationType": "oauth2",
    "baseName": "civil",
    "buildTool": "maven",
    "cacheProvider": "ehcache",
    "creationTimestamp": 1727000215649,
    "databaseType": "sql",
    "devDatabaseType": "postgresql",
    "enableHibernateCache": true,
    "enableSwaggerCodegen": false,
    "enableTranslation": false,
    "entities": [
      "Country",
      "Department",
      "Employee",
      "Job",
      "JobHistory",
      "Location",
      "Region",
      "Task"
    ],
    "feignClient": null,
    "jhipsterVersion": "8.7.0",
    "lastLiquibaseTimestamp": 1727000332000,
    "messageBroker": false,
    "nativeLanguage": "en",
    "packageName": "com.mycompany.myapp",
    "prodDatabaseType": "postgresql",
    "reactive": false,
    "searchEngine": false,
    "serverPort": null,
    "serverSideOptions": [],
    "serviceDiscoveryType": false,
    "skipClient": true,
    "skipUserManagement": true,
    "syncUserWithIdp": true,
    "testFrameworks": [],
    "websocket": false
  }
}
Environment and Tools

java version "17.0.9" 2023-10-17 LTS
Java(TM) SE Runtime Environment (build 17.0.9+11-LTS-201)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.9+11-LTS-201, mixed mode, sharing)

git version 2.39.2.windows.1

node: v20.11.1
npm: 10.2.4

Docker version 24.0.6, build ed223bc

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
@ChangelogDate("20240922101845")
entity Country {
  countryName String
}
@ChangelogDate("20240922101846")
entity Department {
  departmentName String required
}
/**
 * The Employee entity.
 */
@ChangelogDate("20240922101847")
entity Employee {
  /**
   * The firstname attribute.
   */
  firstName String
  lastName String
  email String
  phoneNumber String
  hireDate Instant
  salary Long
  commissionPct Long
}
@ChangelogDate("20240922101848")
entity Job {
  jobTitle String
  minSalary Long
  maxSalary Long
}
@ChangelogDate("20240922101849")
entity JobHistory {
  startDate Instant
  endDate Instant
  language Language
}
/**
 * not an ignored comment
 */
@ChangelogDate("20240922101850")
entity Location {
  streetAddress String
  postalCode String
  city String
  stateProvince String
}
@ChangelogDate("20240922101851")
entity Region {
  regionName String
}
/**
 * Task entity.\n@author The JHipster team.
 */
@ChangelogDate("20240922101852")
entity Task {
  title String
  description String
}

enum Language {
  FRENCH,
  ENGLISH,
  SPANISH
}

relationship OneToOne {
  Country{region} to Region
  Department{location} to Location
  JobHistory{job} to Job
  JobHistory{department} to Department
  JobHistory{employee} to Employee
  Location{country} to Country
}
relationship OneToMany {
  /**
   * A relationship
   */
  Department{employee} to Employee
  Employee{job} to Job
}
relationship ManyToOne {
  Employee{manager} to Employee
}
relationship ManyToMany {
  Job{task(title)} to Task{job}
}

service Country, Department, JobHistory, Location, Region, Task with serviceImpl
search Country, Department, Employee, Job, JobHistory, Location, Region, Task with no
paginate Employee, JobHistory with infinite-scroll
paginate Job with pagination

.yo-rc.json file
{
  "generator-jhipster": {
    "baseName": "civil",
    "clientFramework": "angular",
    "clientTestFrameworks": [],
    "clientTheme": "none",
    "creationTimestamp": 1727000393297,
    "databaseType": "sql",
    "devDatabaseType": "postgresql",
    "devServerPort": 4200,
    "enableTranslation": false,
    "entities": [
      "Country",
      "Department",
      "Employee",
      "Job",
      "JobHistory",
      "Location",
      "Region",
      "Task"
    ],
    "jhipsterVersion": "8.7.0",
    "lastLiquibaseTimestamp": 1727000622000,
    "microfrontend": null,
    "microfrontends": [],
    "nativeLanguage": "en",
    "prodDatabaseType": "postgresql",
    "skipServer": true,
    "testFrameworks": [],
    "withAdminUi": true
  }
}
Environment and Tools

java version "17.0.9" 2023-10-17 LTS
Java(TM) SE Runtime Environment (build 17.0.9+11-LTS-201)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.9+11-LTS-201, mixed mode, sharing)

git version 2.39.2.windows.1

node: v20.11.1
npm: 10.2.4

Docker version 24.0.6, build ed223bc

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
@ChangelogDate("20240922102335")
entity Country {
  countryName String
}
@ChangelogDate("20240922102336")
entity Department {
  departmentName String required
}
/**
 * The Employee entity.
 */
@ChangelogDate("20240922102337")
entity Employee {
  /**
   * The firstname attribute.
   */
  firstName String
  lastName String
  email String
  phoneNumber String
  hireDate Instant
  salary Long
  commissionPct Long
}
@ChangelogDate("20240922102338")
entity Job {
  jobTitle String
  minSalary Long
  maxSalary Long
}
@ChangelogDate("20240922102339")
entity JobHistory {
  startDate Instant
  endDate Instant
  language Language
}
/**
 * not an ignored comment
 */
@ChangelogDate("20240922102340")
entity Location {
  streetAddress String
  postalCode String
  city String
  stateProvince String
}
@ChangelogDate("20240922102341")
entity Region {
  regionName String
}
/**
 * Task entity.\n@author The JHipster team.
 */
@ChangelogDate("20240922102342")
entity Task {
  title String
  description String
}

enum Language {
  FRENCH,
  ENGLISH,
  SPANISH
}

relationship OneToOne {
  Country{region} to Region
  Department{location} to Location
  JobHistory{job} to Job
  JobHistory{department} to Department
  JobHistory{employee} to Employee
  Location{country} to Country
}
relationship OneToMany {
  /**
   * A relationship
   */
  Department{employee} to Employee
  Employee{job} to Job
}
relationship ManyToOne {
  Employee{manager} to Employee
}
relationship ManyToMany {
  Job{task(title)} to Task{job}
}

service Country, Department, JobHistory, Location, Region, Task with serviceImpl
paginate Employee, JobHistory with infinite-scroll
paginate Job with pagination

Browsers and Operating System

Chrome, Windows 10

  • Checking this box is mandatory (this is just to show you read everything)
@mraible
Copy link
Contributor

mraible commented Sep 23, 2024

I have created the hipster app with a backend and frontend separate from the commands below.

This is not how JHIpster is designed to work. If you want a frontend that's not part of a full-stack app, you can use the Ionic or React Native blueprints. Otherwise, the client expects to be packaged with the backend.

@mraible mraible closed this as completed Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants