Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
LemonLDAP NG
lemonldap-ng
Commits
9b7ef2d9
Commit
9b7ef2d9
authored
Nov 02, 2017
by
Clément OUDOT
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some work on Facebook auth module (
#595
)
parent
9738b3db
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/Facebook.pm
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/Facebook.pm
+13
-3
No files found.
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/Facebook.pm
View file @
9b7ef2d9
...
...
@@ -38,7 +38,14 @@ sub extractFormInfo {
# 1.1 Good responses
if
(
my
$code
=
$req
->
param
('
code
')
)
{
if
(
my
$access_token
=
$fb
->
get_access_token
(
code
=>
$code
)
)
{
$self
->
logger
->
debug
("
Get code
$code
from Facebook
");
my
$access_token
;
eval
{
$access_token
=
$fb
->
get_access_token
(
code
=>
$code
);
};
if
(
$@
)
{
$self
->
logger
->
error
("
Error while getting access token: $@
");
return
PE_ERROR
;
}
if
(
$access_token
)
{
$req
->
{
sessionInfo
}
->
{
_facebookToken
}
=
$access_token
;
# Get mandatory fields (see https://developers.facebook.com/tools/explorer)
...
...
@@ -79,11 +86,12 @@ sub extractFormInfo {
return
PE_ERROR
;
}
# Use id fieldto trace user
unless
(
$req
->
{
user
}
=
$datas
->
{
id
}
)
{
# Use id field
to trace user
unless
(
$datas
->
{
id
}
)
{
$self
->
logger
->
error
('
Unable to get Facebook id
');
return
PE_ERROR
;
}
$req
->
user
(
$datas
->
{
id
}
);
$req
->
datas
->
{
_facebookDatas
}
=
$datas
;
# Force redirection to avoid displaying Oauth datas
...
...
@@ -110,6 +118,8 @@ sub extractFormInfo {
display
=>
'
page
',
);
$req
->
urldc
(
$check_url
);
$self
->
logger
->
debug
(
"
Redirect user to
"
.
$req
->
{
urldc
}
);
$req
->
continue
(
1
);
$req
->
steps
(
[]
);
PE_OK
;
}
...
...
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