Build a Basic CRUD App with Angular 7.0 and Spring Boot 2.1

Build a Basic CRUD App with Angular 7.0 and Spring Boot 2.1

Angular and Spring Boot are arguably the two most popular frameworks in all of web development. Matt Raible shows you how to use them together in the same app, and how to secure it all with Okta.

Alex Aldana

Hi Mat, I cloned your git repository, changed your okta credentials to mine, then started up the applications. I am not getting a 500 error from your server. I turned off authentication and the endpoint works correctly. Any clue what might be wrong?

Matt Raible

Is there anything in your logs that indicate what the 500 error is caused by?

Alex Aldana

it says it is an invalid token.

Matt Raible

This usually happens when you have an invalid issuer (make sure you’re using something like https://dev-123456.oktapreview.com/oauth2/default), or your client IDs don’t match. Make sure your client and server are using the same settings.

Sydney

Hi, Matt.

Thanks for this great work. I am having problems trying to run the client code after cloning the code.
It’s a problem with typescript versioning. Please see error below:

I have been trying to resolve this in the last 8 hours without any luck. Google is not helping:

ERROR in The Angular Compiler requires TypeScript >=3.0.1 and <3.1.0 but 2.9.2 was found instead.

Sydney

Oh never mind, Matt. I’ve figured it out finally :slight_smile: . I had to run this command sudo npm install typescript@">=3.0.1 <3.1.0" to force it to pick any version of typescript available between 3.0.1 and 3.1.0 and it picked 3.0.3, which is good enough to be greater than the required 3.0.1.

Khang Nguyen

hi Matt, thanks for this awesome tutorial app you build. I have a small issue when trying to deploy it to heroku. Sorry I’m still a newbie with Angular and Springboot. I appreciate your help.

Heroku’s link:https://blooming-woodland-7…

Github’s repo: https://github.com/mkavo92/…

Matt Raible

What’s the error you’re seeing on Heroku? I can’t help solve the problem if I don’t know what it is. :wink:

Khang Nguyen

This is the error that I received after my attempt to deploy

https://uploads.disquscdn.c…

Khang Nguyen

This is the error that I received after my attempt to deploy

https://uploads.disquscdn.c…

Matt Raible

That’s expected for the server. The blog post has this same screenshot. :slight_smile:

Chuck Canning

Your reminder that angular 7 is out.

Matt Raible

Thanks Chuck! I’ve added this blog post to my list of ones to update this week.

Matt Raible

Hey Chuck - just wanted to let you know that this article has been updated for Angular 7 and Spring 2.1 GA releases.

mtbadi39

Thanks Matt! thanks for this awesome tuto.

Just for info ,for this issue tha am facing : I/O error on GET request for "https://dev-790698.oktaprev… - Connection timed out

it was firewall issue. I was able to get through this error by adding below two lines to main.
System.setProperty(“proxyHost”, “yourproxy.server.com”);
System.setProperty(“proxyPort”, “8080”);

Again, Thank you very much.

doesnt work

The code doesnt work for me :frowning:
http://localhost:4200 and click on the Login button so i redirected to Okta but okta redirect me to http://localhost:4200/implicit/callback

:frowning:
i watch the console and this is the message:

Error
columnNumber: 31

fileName: "http://localhost:4200/polyfills.js"

lineNumber: 3159

message:
"Uncaught (in promise): OAuthError: The response type is not supported
by the authorization server. Configured response types:

doesnt work

i need help :frowning:

Matt Raible

Are you sure you have an Okta developer account and not an Okta IT account? If you do, you might try cloning this blog posts example project, changing the settings to match your Okta tenant (instructions are in the project’s README), then running it.

Chintan Setia

the moment I add in pom.xml following lines

<dependency>
<groupid>com.okta.spring</groupid>
<artifactid>okta-spring-boot-starter</artifactid>
<version>0.6.1</version>
</dependency>

<dependency>
<groupid>org.springframework.security.oauth.boot</groupid>
<artifactid>spring-security-oauth2-autoconfigure</artifactid>
<version>2.1.0.RELEASE</version>
</dependency>

I start getting strarting errors as below
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfiguration’: Unsatisfied dependency expressed through field ‘tokenStore’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘tokenStore’ defined in class path resource [com/okta/spring/oauth/OktaTokenServicesConfig$LocalTokenValidationConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException