Leo Forest
Leo Forest

Reputation: 3

Got 401 error when deploy jhipster monolithic app in production profile

I generated a jhipster monolithic app with V4.13.0 jhipster options below:

>Monolithic 
> Do not use Jhipster Registry
> authentication (stateless, with a token)
> MySQL in production, H2 in-memory in development
> ehcache
> Gradle
> Angular 5
> Do not enable SASS
> Do not enable i18n
> No testing frameworks
> Do not install other generators

I did not modify application-prod.yml except jdbc content; and my angular env is

Angular CLI: 1.6.0
Node: 9.3.0
OS: linux x64
Angular: 5.1.0

package following jh guide

./gradlew  -Pprod clean bootRepackage

and run by

build/libs/xx-0.0.1-SNAPSHOT.war 
----------------------------------------------------------
    Application 'xx' is running! Access URLs:
    Local:      http://localhost:8080
    External:   http://127.0.0.1:8080
    Profile(s):     [prod]
----------------------------------------------------------

but when I request by browser by http://localhost:8080 it got

o.z.p.spring.web.advice.AdviceTrait      : Unauthorized: Full authentication is required to access this resource

browser side error is:

Request URL:http://localhost:8080/api/account
Request Method:GET
Status Code:401 Unauthorized
Remote Address:[::1]:8080
Referrer Policy:no-referrer-when-downgrade

Thanks advance for anyone and any help!

Upvotes: 0

Views: 695

Answers (1)

Gaël Marziou
Gaël Marziou

Reputation: 16284

Unless I misunderstood your issue, it's the expected behavior: you must first authenticate against /api/authenticate to get a token and then use it to access /api/account

Upvotes: 1

Related Questions