Reputation: 1559
I want to get an access token from github, but first I must login. So I made my request and I got a html page as an answer and how to display it to the user ? My javascript variable holds the entire html in it, so how to show this html page to the user ? (it doesn't matter for me if it's a pop up or on the same page) Any answer is appreciated :), web development is new for me.
Client:
$.ajax({
url: localhost + "user/",
cache: false,
success: function(html){
console.log("success");
}
});
Server:
@GetMapping("/user")
public @ResponseBody ResponseEntity<?> user() {
RestTemplate rt = new RestTemplate();
Map<String, String> map = new HashMap<String, String>();
map.put("client_id", "12356....");
map.put("redirect_uri", "http://localhost:5000/DashboardApp/app/index.html#/home");
ResponseEntity<String> response = rt.getForEntity("https://github.com/login/oauth/authorize", String.class, map);
System.out.println(response);
return response;
}
//What I get as a response :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta content="origin" name="referrer" /> ...
Upvotes: 0
Views: 88
Reputation: 2281
You should use $http
instead $ajax
in angular. Like this
$http({
//
})
.then(function(response){
$scope.data= response.data
})
And display in html
{{data}}
You can see the doc in here
Upvotes: 1