현재 제가 해결할 수없는 문제는 bad response from IDP
그 원인이 부족한 mode=select
것인데, 지금은 mode=select
구현해야 할 페이지에 대해 알지 못합니다.
사실 저는 코드를 두 개의 분리 된 페이지에 추가했습니다. 첫 번째는 다음을 수행하는 index.php입니다.
<script type="text/javascript" src="//www.gstatic.com/authtoolkit/js/gitkit.js"></script>
<script type="text/javascript">
var config = {
apiKey: 'AIzaSyAaMAfu7S2AITODrGJzVkIYBXlZR3FYhuQ',
signInSuccessUrl: 'http://www.lascuolacheverra.org/signin?mode=select', // i tried to add the `mode=select here`
signInOptions: ["google", "password"],
idps: ["Google", "AOL", "Microsoft", "Yahoo", "Facebook"],
oobActionUrl: '/',
siteName: 'La scuola che verrà A.P.S.',
// Optional - function called after sign in completes and before
// redirecting to signInSuccessUrl. Return false to disable
// redirect.
// callbacks: {
// signInSuccess: function(tokenString, accountInfo,
// opt_signInSuccessUrl) {
// return true;
// }
// },
// Optional - key for query parameter that overrides
// signInSuccessUrl value (default: 'signInSuccessUrl')
// queryParameterForSignInSuccessUrl: 'url'
// Optional - URL of site ToS (linked and req. consent for signup)
tosUrl: 'http://www.lascuolacheverra.org/privacypolicy.html',
// Optional - URL of callback page (default: current url)
// callbackUrl: 'http://example.com/callback',
// Optional - Cookie name (default: gtoken)
// NOTE: Also needs to be added to config of the ‘page with
// sign in button’. See above
// cookieName: ‘example_cookie’,
// Optional - UI configuration for accountchooser.com
acUiConfig: {
title: 'Sign in to lascuolacheverra.org',
favicon: 'http://www.lascuolacheverra.org/favicon.ico',
branding: 'http://www.lascuolacheverra.org/images/lascuolacheverra.jpg'
},
// Optional - Function to send ajax POST requests to your Recover URL
// Intended for CSRF protection, see Advanced Topics
// url - URL to send the POST request to
// data - Raw data to include as the body of the request
//completed - Function to call with the object that you parse from
// the JSON response text. {} if no response
/*ajaxSender: function(url, data, completed) {
},
*/
};
// The HTTP POST body should be escaped by the server to prevent XSS
window.google.identitytoolkit.start(
'#gitkitWidgetDiv', // accepts any CSS selector
config,
'{{ POST_BODY }}');
</script>
<!-- End modification -->
코드의 두 번째 부분은 다른 index.php에 있으며 다음을 수행합니다.
<!DOCTYPE html>
<html>
<head>
<!-- Copy and paste here the "Sign-in button javascript" you downloaded from Developer Console as gitkit-signin-button.html -->
<script type="text/javascript" src="//www.gstatic.com/authtoolkit/js/gitkit.js"></script>
<link type=text/css rel=stylesheet href="//www.gstatic.com/authtoolkit/css/gitkit.css" />
<script type=text/javascript>
window.google.identitytoolkit.signInButton(
'#navbar', // accepts any CSS selector
{
widgetUrl: "/widget",
signOutUrl: "/",
}
);
</script>
<!-- End configuration -->
</head>
<body>
<!-- Include the sign in button widget with the matching 'navbar' id -->
<div id="navbar"></div>
<!-- End identity toolkit widget -->
<p>
{{ CONTENT }}
</p>
</body>
</html>
mode=select
오늘부터 홈페이지에서 Identity Toolkit을 사용할 수 있지만이 버그로 인해 최대한 사용할 수 없기 때문에 올바르게 사용하려면 어떻게해야하는지 알고 싶습니다 .
signInSuccessUrl : ' http://www.lascuolacheverra.org/signin?mode=select ', //
mode=select here
/signin
페이지를 가리 키지 않아야 합니다. /
또는을 가리킬 수 /signed-in
있습니다.
또한 제거
// signInOptions : [ "google", "password"], // <-이것은 분명히 idps를 마스킹합니다.
idps : [ "Google", "AOL", "Microsoft", "Yahoo", "Facebook"],
나는 이것으로 몇 가지 테스트를 수행했으며 signInOptions를 추가하면 idps가 무시되고 결국 Google 및 비밀번호로만 로그인 할 수 있습니다.
분명히 signInOptions를 사용 하는 것이 그것을하는 방법 입니다. 다른 예제에서 signInOptions 대신 idps를 읽었으며 성공으로 idps를 사용하고 있습니다.
업데이트 코드를 조금 잘못 읽었습니다. \signin
튜토리얼이 아래에 배치하는 위젯을 보여주는 페이지 라고 생각했습니다 \widget
. 내 실수는 내 프로젝트에서 나는 대체하는거야 때문에 \widget
함께 \secure-sign-in
. 따라서 \signin
페이지가 페이지가 아니라면 \widget
코드는 이미 정상입니다. 그리고 ?mode=select
이것은에만 사용 \widget
되며 window.google.identitytoolkit.signInButton
기능에 의해 자동으로 추가 되기 때문에 어떤 경우에도 제거해야 합니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다