This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RestController | |
class WebhooksController { | |
@PostMapping("/webhooks/hubspot") | |
fun hubspot(@RequestBody events: String) { | |
println(events) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
class WebSecurityConfig { | |
@Bean | |
fun oauth2Configuration(http: HttpSecurity): SecurityFilterChain = | |
http | |
// ... | |
.and() | |
.userInfoEndpoint() | |
.userService(oauth2UserService()) | |
.and().and() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spring: | |
security: | |
oauth2: | |
client: | |
... | |
provider: | |
hubspot: | |
... | |
user-info-uri: https://api.hubapi.com/oauth/v1/access-tokens/{accessToken} | |
user-name-attribute: hub_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
class WebSecurityConfig { | |
@Bean | |
fun oauth2Configuration(http: HttpSecurity): SecurityFilterChain = | |
http | |
.oauth2Client() | |
.and() | |
.oauth2Login() | |
.redirectionEndpoint() | |
.baseUri("/oauth2/callback/*") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spring: | |
security: | |
oauth2: | |
client: | |
registration: | |
hubspot: | |
authorization-grant-type: authorization_code | |
client-id: your-client-id | |
client-secret: your-client-secret | |
redirect-uri: https://yourlocal.app/oauth2/callback/hubspot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
// ... | |
implementation("org.springframework.boot:spring-boot-starter-oauth2-client") | |
// ... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Demo App</title> | |
</head> | |
<body> | |
<a href="https://app-eu1.hubspot.com/oauth/authorize?client_id=<your client ID>&redirect_uri=https://yourlocal.app/oauth2/callback/hubspot&scope=crm.objects.leads.read%20settings.users.read"> | |
Connect Hubspot | |
</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Controller | |
class HomeController { | |
@GetMapping("/") | |
fun home() = "home" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
// ... | |
implementation("org.springframework.boot:spring-boot-starter-thymeleaf") | |
// ... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | |
plugins { | |
id("org.springframework.boot") version "2.7.2" | |
id("io.spring.dependency-management") version "1.0.12.RELEASE" | |
kotlin("jvm") version "1.6.21" | |
kotlin("plugin.spring") version "1.6.21" | |
} | |
group = "me.stefanozanella" |