Skip to content

Commit d54a7ea

Browse files
Added oauth2 for Android client, build authentication-service
1 parent 4973584 commit d54a7ea

3 files changed

Lines changed: 64 additions & 0 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.microservice.authentication.controller;
2+
3+
import org.springframework.stereotype.Controller;
4+
import org.springframework.web.bind.annotation.GetMapping;
5+
6+
@Controller
7+
public class AndroidOAuth2Controller {
8+
9+
@GetMapping("/android/oauth2/callback")
10+
public String androidOAuth2Callback() {
11+
// After successful OAuth2 authentication with Google,
12+
// Spring Security redirects here with authenticated session
13+
// Android app will intercept this URL via intent-filter
14+
// and handle the authentication
15+
return "oauth2-android-success";
16+
}
17+
}

authentication-service/src/main/resources/application.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ spring:
9292
redirect-uris:
9393
- "http://127.0.0.1:3000"
9494
- "http://127.0.0.1:9999"
95+
- "http://192.168.1.26:8080/android/oauth2/callback"
96+
- "http://192.168.1.26:9999/android/oauth2/callback"
9597
scopes:
9698
- "openid"
9799
- "profile"
@@ -149,6 +151,7 @@ spring:
149151
- "refresh_token"
150152
redirect-uris:
151153
- "https://spendingbetter.com"
154+
- "https://spendingbetter.com/android/oauth2/callback"
152155
scopes:
153156
- "openid"
154157
- "profile"
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Authentication Successful</title>
7+
<style>
8+
body {
9+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
10+
display: flex;
11+
justify-content: center;
12+
align-items: center;
13+
min-height: 100vh;
14+
margin: 0;
15+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
16+
color: white;
17+
}
18+
.container {
19+
text-align: center;
20+
padding: 2rem;
21+
}
22+
.success-icon {
23+
font-size: 4rem;
24+
margin-bottom: 1rem;
25+
}
26+
h1 {
27+
margin: 0 0 1rem 0;
28+
font-size: 2rem;
29+
}
30+
p {
31+
margin: 0;
32+
font-size: 1.1rem;
33+
opacity: 0.9;
34+
}
35+
</style>
36+
</head>
37+
<body>
38+
<div class="container">
39+
<div class="success-icon"></div>
40+
<h1>Authentication Successful</h1>
41+
<p>You can close this tab and return to the app.</p>
42+
</div>
43+
</body>
44+
</html>

0 commit comments

Comments
 (0)