Giter Site home page Giter Site logo

oktadev / auth0-full-stack-java-example Goto Github PK

View Code? Open in Web Editor NEW
27.0 6.0 15.0 5.49 MB

๐Ÿ”ฅ Full Stack Java Example

Home Page: https://auth0.com/blog/full-stack-java-with-react-spring-boot-and-jhipster/

Shell 0.14% JavaScript 2.55% Batchfile 0.08% Java 51.38% HTML 2.04% SCSS 1.50% TypeScript 41.71% CSS 0.58% Procfile 0.01%
fullstack fullstack-java java spring-boot react auth0 oidc

auth0-full-stack-java-example's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

auth0-full-stack-java-example's Issues

Can't upload photo - javascript error

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()),
    };

Endless redirect between "oauth2/authorization/oidc?error" and "login?error""

Overview of the issue:

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:

  1. Clone the App from this Repository.
  2. Activate the connection in Auth0 as mentioned above and configure Auth0 as described in the tutorial.
  3. Instead of "source" use $env: to set the environment variables.
  4. Start Application and try to login.

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

  • see this git repo

Browsers and Operating System:
OS: Windows 10
Powershell: 5 .1.19041.1320
Browser: Edge Version 98.0.1108.56

  • Checking this box is mandatory (this is just to show you read everything)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.