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
0676afa0
authored
3 years ago
by
agan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改facebook登陆
parent
86099e9a
master
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
31 deletions
footseen/login/index.html
footseen/login/index.html
View file @
0676afa0
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta
charset=
"UTF-8"
>
<script
src=
"login.js"
></script>
<title></title>
<meta
charset=
"UTF-8"
>
<script
src=
"login.js"
></script>
</head>
<body>
<script>
<script>
function
statusChangeCallback
(
response
)
{
// Called with the results from FB.getLoginStatus().
console
.
log
(
response
);
if
(
response
.
status
===
'connected'
)
{
// Logged into your webpage and Facebook.
testAPI
(
response
.
authResponse
.
accessToken
);
}
else
{
// Not logged into your webpage or we are unable to tell.
if
(
url_get_params
().
error
==
undefined
||
url_get_params
().
code
==
undefined
){
if
(
url_get_params
().
error
==
undefined
||
url_get_params
().
code
==
undefined
)
{
window
.
location
.
href
=
"https://www.facebook.com/v6.0/dialog/oauth?client_id=382456482257502&redirect_uri=https://www.footseen.com/footseen/login/index.html&state=045478b9202f7c4913ab5366eaf15f8a"
}
else
{
var
obj
=
{
"cid"
:
22
,
"cid"
:
22
,
"reqCode"
:
new
Date
().
getTime
(),
"data"
:
{
"msg"
:
'facebook登录'
,
"type"
:
2
,
"id"
:
""
,
"name"
:
""
,
"url"
:
""
,
"token"
:
""
"msg"
:
'facebook登录'
,
"type"
:
2
,
"id"
:
""
,
"name"
:
""
,
"url"
:
""
,
"token"
:
""
}
}
var
obj2
=
JSON
.
stringify
(
obj
);
...
...
@@ -38,28 +40,28 @@
function
checkLoginState
()
{
// Called when a person is finished with the Login Button.
FB
.
getLoginStatus
(
function
(
response
)
{
// See the onlogin handler
FB
.
getLoginStatus
(
function
(
response
)
{
// See the onlogin handler
statusChangeCallback
(
response
);
});
}
window
.
fbAsyncInit
=
function
()
{
window
.
fbAsyncInit
=
function
()
{
FB
.
init
({
appId
:
'382456482257502'
,
xfbml
:
true
,
cookie
:
true
,
// enable cookies to allow the server to access
version
:
'v6
.0'
appId
:
'382456482257502'
,
xfbml
:
true
,
cookie
:
true
,
// enable cookies to allow the server to access
version
:
'v12
.0'
});
FB
.
getLoginStatus
(
function
(
response
)
{
// Called after the JS SDK has been initialized.
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
(
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
;
...
...
@@ -69,18 +71,18 @@
function
testAPI
(
token
)
{
FB
.
api
(
'/me?fields=email,name,id,picture.width(200).height(200)'
,
function
(
response
)
{
FB
.
api
(
'/me?fields=email,name,id,picture.width(200).height(200)'
,
function
(
response
)
{
console
.
log
(
'登录成功'
);
var
obj
=
{
"cid"
:
22
,
"cid"
:
22
,
"reqCode"
:
new
Date
().
getTime
(),
"data"
:
{
"msg"
:
'facebook登录'
,
"type"
:
1
,
"id"
:
response
.
id
,
"name"
:
response
.
name
,
"url"
:
response
.
picture
.
data
.
url
,
"token"
:
token
"msg"
:
'facebook登录'
,
"type"
:
1
,
"id"
:
response
.
id
,
"name"
:
response
.
name
,
"url"
:
response
.
picture
.
data
.
url
,
"token"
:
token
}
}
var
obj2
=
JSON
.
stringify
(
obj
);
...
...
@@ -92,16 +94,17 @@
function
url_get_params
()
{
var
url
=
location
.
href
;
var
theRequest
=
new
Object
();
if
(
url
.
indexOf
(
"?"
)
!=
-
1
)
{
if
(
url
.
indexOf
(
"?"
)
!=
-
1
)
{
var
str
=
url
.
substr
(
url
.
indexOf
(
"?"
)
+
1
);
strs
=
str
.
split
(
"&"
);
for
(
var
i
=
0
;
i
<
strs
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
strs
.
length
;
i
++
)
{
theRequest
[
strs
[
i
].
split
(
"="
)[
0
]]
=
unescape
(
strs
[
i
].
split
(
"="
)[
1
]);
}
}
return
theRequest
;
}
</script>
</script>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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