react-es-fb-login 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -28,19 +28,6 @@ exports.SDK_SCRIPT_ELE_ID = 'facebook-jssdk';
|
|
|
28
28
|
* double-encoded as 'code%2520token'. */
|
|
29
29
|
const normalizeResponseType = (options) => options.response_type === 'code%20token'
|
|
30
30
|
? Object.assign(Object.assign({}, options), { response_type: 'code token' }) : options;
|
|
31
|
-
/** With `override_default_response_type` enabled, the JS SDK forwards
|
|
32
|
-
* `response_type` to the OAuth dialog verbatim, so a lone 'code' never yields
|
|
33
|
-
* an access token. Upgrade 'code' to the combined 'code token' value so
|
|
34
|
-
* `authResponse` carries the authorization `code` together with `accessToken`
|
|
35
|
-
* and `userID`. */
|
|
36
|
-
const withAccessToken = (options) => {
|
|
37
|
-
const normalized = normalizeResponseType(options);
|
|
38
|
-
if (normalized.override_default_response_type === true &&
|
|
39
|
-
normalized.response_type === 'code') {
|
|
40
|
-
return Object.assign(Object.assign({}, normalized), { response_type: 'code token' });
|
|
41
|
-
}
|
|
42
|
-
return normalized;
|
|
43
|
-
};
|
|
44
31
|
exports.FacebookLoginClient = {
|
|
45
32
|
getFB: () => {
|
|
46
33
|
if (!window.FB) {
|
|
@@ -91,13 +78,13 @@ exports.FacebookLoginClient = {
|
|
|
91
78
|
{ ignoreSdkError } = _a, loginOptions = __rest(_a,
|
|
92
79
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
93
80
|
["ignoreSdkError"]);
|
|
94
|
-
window.location.href = `https://www.facebook.com/dialog/oauth${(0, helpers_1.objectToParams)(Object.assign(Object.assign({}, dialogParams),
|
|
81
|
+
window.location.href = `https://www.facebook.com/dialog/oauth${(0, helpers_1.objectToParams)(Object.assign(Object.assign({}, dialogParams), normalizeResponseType(loginOptions)))}`;
|
|
95
82
|
},
|
|
96
83
|
login(callback, _a) {
|
|
97
84
|
var _b;
|
|
98
85
|
var { ignoreSdkError } = _a, loginOptions = __rest(_a, ["ignoreSdkError"]);
|
|
99
86
|
try {
|
|
100
|
-
(_b = this.getFB()) === null || _b === void 0 ? void 0 : _b.login(callback,
|
|
87
|
+
(_b = this.getFB()) === null || _b === void 0 ? void 0 : _b.login(callback, normalizeResponseType(loginOptions));
|
|
101
88
|
}
|
|
102
89
|
catch (e) {
|
|
103
90
|
if (ignoreSdkError) {
|
package/dist/types/fb.type.d.ts
CHANGED
|
@@ -9,21 +9,21 @@ export type LoginResponse = {
|
|
|
9
9
|
};
|
|
10
10
|
export type SuccessResponse = {
|
|
11
11
|
/** An access token for the person using the webpage. */
|
|
12
|
-
accessToken
|
|
12
|
+
accessToken?: string;
|
|
13
13
|
/**
|
|
14
14
|
* A UNIX time stamp when the token expires. Once the token expires, the person will need to login again.
|
|
15
15
|
*/
|
|
16
|
-
expiresIn
|
|
16
|
+
expiresIn?: string;
|
|
17
17
|
/**
|
|
18
18
|
* The amount of time before the login expires, in seconds, and the person will need to login again.
|
|
19
19
|
*/
|
|
20
|
-
reauthorize_required_in
|
|
20
|
+
reauthorize_required_in?: string;
|
|
21
21
|
/**
|
|
22
22
|
* A signed parameter that contains information about the person using your webpage.
|
|
23
23
|
*/
|
|
24
|
-
signedRequest
|
|
24
|
+
signedRequest?: string;
|
|
25
25
|
/** The ID of the person using your webpage. */
|
|
26
|
-
userID
|
|
26
|
+
userID?: string;
|
|
27
27
|
/** An authorization code returned when `response_type` includes 'code'. */
|
|
28
28
|
code?: string;
|
|
29
29
|
/** Comma-separated list of granted scopes, returned when `return_scopes` is true. */
|