# Build a Photo Gallery PWA with React, Spring Boot, and JHipster

**URL:** <https://devforum.okta.com/t/build-a-photo-gallery-pwa-with-react-spring-boot-and-jhipster/16888>\
**Category:** Developer Blog Comments\
**Created:** [June 25, 2018, 3:02pm UTC](https://devforum.okta.com/t/build-a-photo-gallery-pwa-with-react-spring-boot-and-jhipster/16888 "2018-06-25T15:02:09Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [June 25, 2018, 3:02pm UTC](https://devforum.okta.com/t/build-a-photo-gallery-pwa-with-react-spring-boot-and-jhipster/16888/1 "2018-06-25T15:02:09Z")

</div>

[Build a Photo Gallery PWA with React, Spring Boot, and JHipster](https://developer.okta.com/blog/2018/06/25/react-spring-boot-photo-gallery-pwa)

This post shows you how to build a photo gallery progressive web app with Spring Boot, React, and JHipster 5. It uses OAuth’s authorization code for authorization and OIDC for authentication. It extracts EXIF metadata from images, and displays them on the UI in a flexible grid format like Flickr does.

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [July 2, 2018, 9:03pm UTC](https://devforum.okta.com/t/build-a-photo-gallery-pwa-with-react-spring-boot-and-jhipster/16888/2 "2018-07-02T21:03:27Z")

</div>

**Marcus Rosa Pereira**

Very good article.  
Just a small correction: jHipster has a web interface, as well as it’s Spring Initializr, so that it’s not need to download it’s cli creator.

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [July 5, 2018, 7:47pm UTC](https://devforum.okta.com/t/build-a-photo-gallery-pwa-with-react-spring-boot-and-jhipster/16888/3 "2018-07-05T19:47:35Z")

</div>

**js DNL mrls RS**

Hi!!!

It’s an awesome utility, I started to play with it, but unfortunately it throws an error on ‘yarn e2e’ command, Do you have some suggest?

Greetings,

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [July 5, 2018, 9:22pm UTC](https://devforum.okta.com/t/build-a-photo-gallery-pwa-with-react-spring-boot-and-jhipster/16888/4 "2018-07-05T21:22:06Z")

</div>

**Matt Raible**

Running `yarn e2e` works on my machine. I had to do the following steps before running it:

1. Run `yarn webpack:build` so the React UI will be transpiled.  
2. Run `./mvnw` in one terminal.  
3. Run `docker-compose src/main/docker/keycloak.yml up` in another terminal.  
4. Run `yarn e2e` in a third terminal.

**NOTE:** If you have PostgreSQL installed on your machine, you may need to [modify keycloak.yml](https://github.com/oktadeveloper/okta-react-photo-gallery-example/commit/1a04a901c1fb6f63047e5eca4f1e7243ae9228d8 "https://github.com/oktadeveloper/okta-react-photo-gallery-example/commit/1a04a901c1fb6f63047e5eca4f1e7243ae9228d8") to force it to use H2. This is a bug in Keycloak v4, which we [fixed in JHipster 5.0.2](https://github.com/jhipster/generator-jhipster/pull/7913 "https://github.com/jhipster/generator-jhipster/pull/7913").

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [July 5, 2018, 11:12pm UTC](https://devforum.okta.com/t/build-a-photo-gallery-pwa-with-react-spring-boot-and-jhipster/16888/5 "2018-07-05T23:12:14Z")

</div>

**js DNL mrls RS**

Awesome!!! It lives, thanks Matt

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [July 23, 2018, 9:07pm UTC](https://devforum.okta.com/t/build-a-photo-gallery-pwa-with-react-spring-boot-and-jhipster/16888/6 "2018-07-23T21:07:59Z")

</div>

**TalG**

had some issues with the yarn e2e part so im just leaving the solution here incase anyone else needs it:

when sudo yarn e2e I got the following error:

WebDriverError: unknown error: DevToolsActivePort file doesn’t exist

So I installed the chrome dependencies:  
# Install dependencies.

sudo apt-get update

sudo apt-get install -y unzip openjdk-8-jre-headless xvfb libxi6 libgconf-2-4

and then I run yarn e2e (without sudo!) - and got the following error:

E/launcher - Error: Error: EACCES: permission denied, open '/tmp/ts-node-83664a171b996f6b47b27940c0e540adb38adffecc1f827bd3d8f57934963ed3/2497da76d71a693fc309ca76f7cea103df61078c4d815af0552ff9b08e991fe5/940b241aae25b0ad4670cdd0343cfd0879f9ebeb2b8b84cff95122dfbe180ce0.js’

so then I just:

/tmp$ sudo chown -R notSudoUserName:notSudoUserName ts-node-83664a171b996f6b47b27940c0e540adb38adffecc1f827bd3d8f57934963ed3

and then yarn e2e again (no sudo!) and it all worked.

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [October 3, 2018, 9:02am UTC](https://devforum.okta.com/t/build-a-photo-gallery-pwa-with-react-spring-boot-and-jhipster/16888/7 "2018-10-03T09:02:33Z")

</div>

**Miguel Duran**

I ran into some errors in the “Create Entities” section. When I ran jhipster import-jdl, there are 9 errors that all look like this:

ERROR in /home/miguel/workspace/gallery/src/main/webapp/app/entities/album/album-delete-dialog.tsx  
(12,97): Type ‘{ id: number; }’ does not satisfy the constraint ‘{ id?: string; }’.  
 Types of property ‘id’ are incompatible.  
 Type ‘number’ is not assignable to type ‘string’.

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [October 3, 2018, 11:48am UTC](https://devforum.okta.com/t/build-a-photo-gallery-pwa-with-react-spring-boot-and-jhipster/16888/8 "2018-10-03T11:48:31Z")

</div>

**Matt Raible**

What version of JHipster are you using? Can you try the latest release (5.3.4)?

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [October 4, 2018, 6:15am UTC](https://devforum.okta.com/t/build-a-photo-gallery-pwa-with-react-spring-boot-and-jhipster/16888/9 "2018-10-04T06:15:21Z")

</div>

**Miguel Duran**

I was using 5.0.1 as recommended in the guide, and upgrading fixed it, thanks!

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [October 5, 2018, 1:21pm UTC](https://devforum.okta.com/t/build-a-photo-gallery-pwa-with-react-spring-boot-and-jhipster/16888/10 "2018-10-05T13:21:29Z")

</div>

**lime**

for your information this is the problem solved by the last release of Jhipster:

[https://stackoverflow.com/q…](https://stackoverflow.com/questions/52394115/type-id-number-does-not-satisfy-the-constraint-id-string "https://stackoverflow.com/questions/52394115/type-id-number-does-not-satisfy-the-constraint-id-string")

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [October 10, 2018, 7:58am UTC](https://devforum.okta.com/t/build-a-photo-gallery-pwa-with-react-spring-boot-and-jhipster/16888/11 "2018-10-10T07:58:30Z")

</div>

**Guido Zockoll**

Hi,  
thanks for sharing. That helped me alot about handling photos in JHipster.  
Is there a way to get the original filename of the photo?

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [October 10, 2018, 3:26pm UTC](https://devforum.okta.com/t/build-a-photo-gallery-pwa-with-react-spring-boot-and-jhipster/16888/12 "2018-10-10T15:26:29Z")

</div>

**Matt Raible**

I image it’s possible, but you’d have to store the value in a separate (hidden) field when the user first selects it. We do this now with the [`setFileData()`](https://github.com/oktadeveloper/okta-react-photo-gallery-example/blob/master/src/main/webapp/app/entities/photo/photo-update.tsx#L51 "https://github.com/oktadeveloper/okta-react-photo-gallery-example/blob/master/src/main/webapp/app/entities/photo/photo-update.tsx#L51") method. You can find the source of that method [in react-jhipster](https://github.com/jhipster/react-jhipster/blob/master/src/util/data-utils.ts#L50 "https://github.com/jhipster/react-jhipster/blob/master/src/util/data-utils.ts#L50").

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [November 5, 2018, 5:51pm UTC](https://devforum.okta.com/t/build-a-photo-gallery-pwa-with-react-spring-boot-and-jhipster/16888/13 "2018-11-05T17:51:26Z")

</div>

**Jacek**

Hi Matt,

could you prepare a tutorial to show how to configure JHipster with Azure AD B2C instead of Okta? I prefer Okta but unfortunately not our customer…

Regards,  
Jacek

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [November 5, 2018, 5:54pm UTC](https://devforum.okta.com/t/build-a-photo-gallery-pwa-with-react-spring-boot-and-jhipster/16888/14 "2018-11-05T17:54:18Z")

</div>

**Matt Raible**

Hello Jacek: I doubt Okta would pay me to write that tutorial. 😉

If Azure AD B2C supports OAuth 2.0 and OIDC, it should be possible to set environment variables that point to the various endpoints. For example, here’s what I use to configure a JHipster app to use Okta:

```
export SECURITY_OAUTH2_CLIENT_ACCESS_TOKEN_URI="https://dev-737523.oktapreview.com/oauth2/default/v1/token"export SECURITY_OAUTH2_CLIENT_USER_AUTHORIZATION_URI="https://dev-737523.oktapreview.com/oauth2/default/v1/authorize"export SECURITY_OAUTH2_RESOURCE_USER_INFO_URI="https://dev-737523.oktapreview.com/oauth2/default/v1/userinfo"export SECURITY_OAUTH2_CLIENT_CLIENT_ID="XXX"export SECURITY_OAUTH2_CLIENT_CLIENT_SECRET=“YYY”
```

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [November 6, 2018, 2:07pm UTC](https://devforum.okta.com/t/build-a-photo-gallery-pwa-with-react-spring-boot-and-jhipster/16888/15 "2018-11-06T14:07:44Z")

</div>

**Jacek**

Thanks Matt,

I try to find matching variables on Azure.

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [November 14, 2018, 6:02pm UTC](https://devforum.okta.com/t/build-a-photo-gallery-pwa-with-react-spring-boot-and-jhipster/16888/16 "2018-11-14T18:02:51Z")

</div>

**Jacek**

Hi Matt again,

the customer has agreed to use Okta!

Could you point a tutorial how to customize and localize the Okta login page? You know, own logo, own background picture, some additional texts and the language of the login page matches the language set in JHipster app before login action.

Regards,  
Jacek

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [November 20, 2018, 10:19pm UTC](https://devforum.okta.com/t/build-a-photo-gallery-pwa-with-react-spring-boot-and-jhipster/16888/17 "2018-11-20T22:19:53Z")

</div>

**Matt Raible**

Hello Jacek - great news! Sorry for the delayed response. Our [live widget demo](https://developer.okta.com/live-widget/ "https://developer.okta.com/live-widget/") is a good way to learn how to customize the sign-in widget.

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [April 24, 2019, 12:35pm UTC](https://devforum.okta.com/t/build-a-photo-gallery-pwa-with-react-spring-boot-and-jhipster/16888/18 "2019-04-24T12:35:17Z")

</div>

**sumanpatra**

Hi Matt,  
Are ImageBlob have any side effects , should I store images in S3 …

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [April 27, 2019, 11:38pm UTC](https://devforum.okta.com/t/build-a-photo-gallery-pwa-with-react-spring-boot-and-jhipster/16888/19 "2019-04-27T23:38:41Z")

</div>

**Matt Raible**

JHipster stores ImageBlog’s as base64 strings. You could modify the code to upload to S3, but I’m not sure if it’s necessary. If you did do that, you’ll probably want to change things so you saved the S3 URL in your database. [Uploading files to AWS S3 Bucket using Spring Boot](https://medium.com/oril/uploading-files-to-aws-s3-bucket-using-spring-boot-483fcb6f8646 "https://medium.com/oril/uploading-files-to-aws-s3-bucket-using-spring-boot-483fcb6f8646") might help.
