-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Auth Method Added. #4484
New Auth Method Added. #4484
Conversation
1. add google Play Games Authentication Method(different from Google due to GPG is using a new ID method). 2. add Game Center Authentication Method. By refering to the URL that provided: https://developer.apple.com/documentation/gamekit/gklocalplayer/1515407-generateidentityverificationsign?language=objc
check using the funciton hasOwnProperty.
fix error for Google Play Games.
Temporary enable this to allow PR Success
1. remove old rest.spec test as it is actually wrong. 2. added the test at AuthenticationAdapters.spec.js. 3. put back the index.js change to search for where to change exactly.
Codecov Report
@@ Coverage Diff @@
## master #4484 +/- ##
==========================================
- Coverage 92.8% 91.97% -0.83%
==========================================
Files 118 121 +3
Lines 8394 8515 +121
==========================================
+ Hits 7790 7832 +42
- Misses 604 683 +79
Continue to review full report at Codecov.
|
src/Adapters/Auth/index.js
Outdated
|
||
var _AdapterLoader2 = _interopRequireDefault(_AdapterLoader); | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you copied compiled babel. Doesn't look like something humans write.
src/Adapters/Auth/index.js
Outdated
xiaomi | ||
}; | ||
|
||
function authDataValidator(adapter, appIds, options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sticking to the current coding style / ES6 would be ideal.
src/Adapters/Auth/index.js
Outdated
} | ||
|
||
function loadAuthAdapter(provider, authOptions) { | ||
const defaultAdapter = providers[provider]; | ||
const adapter = Object.assign({}, defaultAdapter); | ||
const providerOptions = authOptions[provider]; | ||
|
||
if (!defaultAdapter && !providerOptions) { | ||
if (!defaultAdapter && !providerOptions) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its recommended to always use brackets for if / else statements. Without them they can lead to bugs. You might want to go over your code again for consistency
src/Adapters/Auth/index.js
Outdated
|
||
const appIds = providerOptions ? providerOptions.appIds : undefined; | ||
|
||
// Try the configuration methods | ||
if (providerOptions) { | ||
const optionalAdapter = loadAdapter(providerOptions, undefined, providerOptions); | ||
const optionalAdapter = (0, _AdapterLoader2.default)(providerOptions, undefined, providerOptions); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Babel
already changed accordingly. Please let me know if there is anything else. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes made.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a lot of things that need to be changed here. For starters if you can undo those stylistic changes that will make it much easier for us to stay focused on just the functional changes you're introducing.
If you do feel you want to introduce stylistic changes to existing code, and have justification for doing so, feel free to open up a separate PR specifically for doing that.
::edit:: Additionally diff coverage by this PR is negative. You'll need to inspect the coverage results and account for untested code paths, which may involve adjusting your code to make it testable.
return adapter.validateAppId(appIds, authData, options); | ||
} | ||
return Promise.resolve(); | ||
}); | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you revert these style changes?
Generally you should avoid unnecessary stylistic changes when adding a feature unless it's part of the change itself (i.e. specifically a stylistic change PR). In this case it's superfluous and adds to what we have to review. It'll make it much easier for us to go through and review your changes if they're only functional changes.
@@ -70,7 +78,7 @@ function loadAuthAdapter(provider, authOptions) { | |||
if (providerOptions) { | |||
const optionalAdapter = loadAdapter(providerOptions, undefined, providerOptions); | |||
if (optionalAdapter) { | |||
['validateAuthData', 'validateAppId'].forEach((key) => { | |||
['validateAuthData', 'validateAppId'].forEach(key => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. This can and should be suggested separately.
@@ -82,18 +90,26 @@ function loadAuthAdapter(provider, authOptions) { | |||
return; | |||
} | |||
|
|||
return {adapter, appIds, providerOptions}; | |||
return { adapter, appIds, providerOptions }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
// To handle the test cases on configuration | ||
const getValidatorForProvider = function(provider) { | ||
const getValidatorForProvider = function (provider) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and above here
}) | ||
} | ||
}); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed for this PR, let's kept it focused on what you're actually introducing.
|
||
// Returns a promise that fulfills if this user id is valid. | ||
function validateAuthData(authData, authOptions) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, keep the curly braces up on the same line. It's inconsistent throughout this file as well if you can amend that.
var crypto = require('crypto'); | ||
|
||
const PRODUCTION_URL = "https://cn-api.unity.com"; | ||
const DEBUG_URL = " https://cn-api-debug.unity.com"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This url doesn't seem right, xiaomi is unity? Can you clarify this 3rd party provider and the urls?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Added the following Authentication Provider: