Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
libai
/
footsen
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
60636bb5
authored
Mar 06, 2020
by
dabai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
facebook登录
parent
bba0d2f7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
72 deletions
login/index.html
login/index.html
deleted
100644 → 0
View file @
bba0d2f7
<!DOCTYPE html>
<html>
<head>
<title>
Facebook Login JavaScript Example
</title>
<meta
charset=
"UTF-8"
>
</head>
<body>
<script>
function
statusChangeCallback
(
response
)
{
// Called with the results from FB.getLoginStatus().
console
.
log
(
'statusChangeCallback'
);
console
.
log
(
response
);
// The current login status of the person.
if
(
response
.
status
===
'connected'
)
{
// Logged into your webpage and Facebook.
testAPI
();
}
else
{
// Not logged into your webpage or we are unable to tell.
document
.
getElementById
(
'status'
).
innerHTML
=
'Please log '
+
'into this webpage.'
;
}
}
function
checkLoginState
()
{
// Called when a person is finished with the Login Button.
FB
.
getLoginStatus
(
function
(
response
)
{
// See the onlogin handler
statusChangeCallback
(
response
);
});
}
window
.
fbAsyncInit
=
function
()
{
FB
.
init
({
appId
:
'382456482257502'
,
xfbml
:
true
,
version
:
'v6.0'
});
FB
.
getLoginStatus
(
function
(
response
)
{
// Called after the JS SDK has been initialized.
statusChangeCallback
(
response
);
// Returns the login status.
});
};
(
function
(
d
,
s
,
id
)
{
// Load the SDK asynchronously
var
js
,
fjs
=
d
.
getElementsByTagName
(
s
)[
0
];
if
(
d
.
getElementById
(
id
))
return
;
js
=
d
.
createElement
(
s
);
js
.
id
=
id
;
js
.
src
=
"https://connect.facebook.net/en_US/sdk.js"
;
fjs
.
parentNode
.
insertBefore
(
js
,
fjs
);
}(
document
,
'script'
,
'facebook-jssdk'
));
function
testAPI
()
{
// Testing Graph API after login. See statusChangeCallback() for when this call is made.
console
.
log
(
'Welcome! Fetching your information.... '
);
FB
.
api
(
'/me'
,
function
(
response
)
{
console
.
log
(
'Successful login for: '
+
response
.
name
);
document
.
getElementById
(
'status'
).
innerHTML
=
'Thanks for logging in, '
+
response
.
name
+
'!'
;
});
}
</script>
<fb:login-button
scope=
"public_profile,email"
onlogin=
"checkLoginState();"
>
</fb:login-button>
<div
id=
"status"
>
</div>
</body>
</html>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment