Google 클라우드 엔드 포인트에서 firebase 토큰을 확인하는 방법을 (일부 샘플 코드로) 지정할 수 있습니까? 최근에 질문하는 내용이 전혀 명확하지 않습니다. (How to integrate firebase authentication with google app engine endpoints)Google 애플리케이션 엔진 클라우드 엔드 포인트와 firebase 인증 통합
Google 인증은 엔드 포인트에 사용자 매개 변수를 추가하여 자동으로 수행됩니다.
@ApiMethod(name = "endpoint.addUser", httpMethod = HttpMethod.POST)
public ResultObject addUser(HttpServletRequest request, User pUser) throws OAuthRequestException {
String token = request.getHeader("Authorization");
String graphUrl = "https://graph.facebook.com/v2.6/me?fields=id,name,email&access_token=" + token;
URL u = new URL(g);
URLConnection c = u.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(c.getInputStream()));
String inputLine;
StringBuffer b = new StringBuffer();
while ((inputLine = in.readLine()) != null){
b.append(inputLine + "\n");
}
in.close();
graph = b.toString();
JSONObject json = new JSONObject(graph);
facebookId = json.getString("id");
email = json.getString("email");
//...
}
는 페이스 북 토큰처럼 쉽게 중포 기지 토큰의 검증인가 : 페이스 북 토큰이 같은 페이스 북의 그래프 API를 가진 클라우드 엔드 포인트에서 확인 할 수있다? firebase 토큰에서 전자 메일을 검색 할 수 있습니까?
필자는 Firebase에 대해 정확히 대답 할 수는 없지만 이것이 인증을 통합하는 올바른 방법이 아니라고 말할 수 있습니다. 대신에 com.google.api.server.spi.config.Authenticator를 구현해야합니다. 그런 다음 주석에 'Authenticator'를 지정하십시오. 필자는 Firebase 인증 토큰이 JWT라고 믿기 때문에 인증 요청을 보내지 않아도됩니다. – saiyr
예 thats corect. 마지막 구현에서는 Authenticator를 사용합니다. 데모 용 코드 만 포함하려고했습니다. – SmilingM
firebase의 경우 토큰을 확인하려는 이유는 이미 실행중인 앱 엔진 끝 점이 있기 때문입니다. 이제 firebase auth를 클라이언트에서 사용하고 클라우드 엔드 포인트에 대해 인증하려고합니다. 나는 firebase 실시간 데이터베이스로 지금 옮기고 싶지 않다. – SmilingM