oktadev / auth0-full-stack-java-example Goto Github PK
View Code? Open in Web Editor NEW๐ฅ Full Stack Java Example
Home Page: https://auth0.com/blog/full-stack-java-with-react-spring-boot-and-jhipster/
๐ฅ Full Stack Java Example
Home Page: https://auth0.com/blog/full-stack-java-with-react-spring-boot-and-jhipster/
Hey! I can login and create tags, albums, photos, etc, and it seems to work great.
But when I try and save a photo, clicking on the "Save" button seems to fail silently.
Looking in the console, I see the following:
photo-update.tsx:47 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'toString')
at photo-update.tsx:47:1
at Array.find (<anonymous>)
at saveEntity (photo-update.tsx:47:1)
at index.cjs.js:1:1
which leads me to the const entity
line below:
const saveEntity = values => {
values.taken = convertDateTimeToServer(values.taken);
values.uploaded = convertDateTimeToServer(values.uploaded);
const entity = {
...photoEntity,
...values,
tags: mapIdList(values.tags),
album: albums.find(it => it.id.toString() === values.album.toString()),
};
After I completed the Tutorial (https://auth0.com/blog/full-stack-java-with-react-spring-boot-and-jhipster/) to integrate Auth0 to my Application. I tried to login to the generated Application and get an endless redirection between
"http://localhost:8080/oauth2/authorization/oidc?error"
and
"http://localhost:8080/login?error".
In the browser i get the following error:
"error-middleware.ts:20 authentication/get_account/rejected caught at middleware with reason: "Request failed with status code 401"."
"error-middleware.ts:23 Actual cause: error.http.401"
I did the exact steps, except on windows i had to set the environment variables as followed:
$env:SPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_OIDC_ISSUER_URI = 'https://???.auth0.com/'
$env:SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_OIDC_CLIENT_ID = 'fsd???'
$env:SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_OIDC_CLIENT_SECRET = 'xoO????'
$env:JHIPSTER_SECURITY_OAUTH2_AUDIENCE = 'https://???.auth0.com/api/v2/'
Also i had to set a connection in Auth0 to create a User:
Auth0 -> Authentification -> Database -> Username-Password-Authentication -> Applications -> Add my Application
I also tried it with this git repo and had the same thing.
Maybe there is something missing with the use of it in windows or am i missing something in the auth0 configuration?
Motivation for or Use Case:
The Application should be configured with Auth0.
Reproduce the error:
Related issues
n/a
Suggest a Fix
n/a
JHipster configuration
jhipster info
##### **JHipster Version(s)**
[email protected] C:\Users\Christian\Desktop\flickr2\auth0-full-stack-java-example
-- [email protected]
##### **JHipster configuration, a .yo-rc.json file generated in the root folder**
<details>
<summary>.yo-rc.json file</summary>
<pre>
{
"generator-jhipster": {
"applicationType": "monolith",
"baseName": "flickr2",
"jhipsterVersion": "7.3.1",
"skipClient": false,
"skipServer": false,
"skipUserManagement": true,
"skipCheckLengthOfIdentifier": false,
"skipFakeData": false,
"jhiPrefix": "jhi",
"entitySuffix": "",
"dtoSuffix": "DTO",
"testFrameworks": ["cypress"],
"blueprints": [],
"otherModules": [],
"pages": [],
"creationTimestamp": 1634022348068,
"serviceDiscoveryType": "no",
"reactive": false,
"authenticationType": "oauth2",
"packageName": "com.auth0.flickr2",
"serverPort": "8080",
"cacheProvider": "ehcache",
"enableHibernateCache": true,
"databaseType": "sql",
"devDatabaseType": "h2Disk",
"prodDatabaseType": "postgresql",
"buildTool": "maven",
"serverSideOptions": [],
"websocket": false,
"searchEngine": false,
"messageBroker": false,
"enableSwaggerCodegen": false,
"clientFramework": "react",
"withAdminUi": true,
"clientTheme": "united",
"clientThemeVariant": "dark",
"enableTranslation": true,
"nativeLanguage": "en",
"devServerPort": 9060,
"clientPackageManager": "npm",
"languages": ["en", "pt-br"],
"enableGradleEnterprise": false,
"entities": ["Album", "Photo", "Tag"],
"lastLiquibaseTimestamp": 1634025089000,
"herokuAppName": "flickr-2",
"herokuDeployType": "git",
"herokuJavaVersion": "11",
"useOkta": false
}
}
</pre>
</details>
##### **JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory**
<details>
<summary>JDL entity definitions</summary>
<pre>
entity Album {
title String required
description TextBlob
created Instant
}
entity Photo {
title String required
description TextBlob
image ImageBlob required
height Integer
width Integer
taken Instant
uploaded Instant
}
entity Tag {
name String required minlength(2)
}
relationship ManyToOne {
Album{user(login)} to User
Photo{album(title)} to Album
}
relationship ManyToMany {
Photo{tag(name)} to Tag{photo}
}
paginate Album with pagination
paginate Photo, Tag with infinite-scroll
</pre>
</details>
##### **Environment and Tools**
openjdk version "11.0.14" 2022-01-18
OpenJDK Runtime Environment Temurin-11.0.14+9 (build 11.0.14+9)
OpenJDK 64-Bit Server VM Temurin-11.0.14+9 (build 11.0.14+9, mixed mode)
git version 2.35.1.windows.2
node: v16.14.0
npm: 8.3.1
Docker version 20.10.12, build e91ed57
docker-compose version 1.29.2, build 5becea4c
No change to package.json was detected. No package manager install will be executed.
Congratulations, JHipster execution is complete!
Sponsored with โค๏ธ by @oktadev.
JHipster configuration, a .yo-rc.json file generated in the root folder
Browsers and Operating System:
OS: Windows 10
Powershell: 5 .1.19041.1320
Browser: Edge Version 98.0.1108.56
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.