-
Notifications
You must be signed in to change notification settings - Fork 219
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
Fixed - Ensure existing refreshToken returned in Credentials Manager #146
Conversation
Added - Renewed credentials are autosaved in Credentials Manager
refreshToken: refreshToken, | ||
expiresIn: credentials.expiresIn, | ||
scope: credentials.scope) | ||
_ = self.store(credentials: newCredentials) |
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.
what does the _
mean?? I can't find it as a declared variable in the class scope.
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.
Is to avoiding warnings, if I set it to a variable e.g. foo = self...
Xcode would warn that it is not used. So you use _ =
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.
Why set it anyway if it's not being used?
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.
You get a warning if it's not set 😄
@@ -69,7 +69,6 @@ public class _ObjectiveManagementAPI: NSObject { | |||
} | |||
|
|||
@objc(unlinkUserWithIdentifier:provider:fromUserId:callback:) | |||
// swiftlint:disable:next function_parameter_count |
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.
Why are all this lint checks removed?
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.
In latest Swiftlint 0.22 they are no longer required.
Line 47: SwiftLint rule 'function_parameter_count' did not trigger a violation in the disabled region. Please remove the disable command.
[03:09:56]: ▸ /Users/distiller/Auth0.swift/Auth0/OAuth2Grant.swift
credentialsManager.credentials { error = $0; newCredentials = $1 | ||
expect(error).to(beNil()) | ||
credentialsManager.credentials { | ||
expect($1!.accessToken) == NewAccessToken |
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.
here you use $1!
but in the above test you refer to the same value as newCredentials
. Why?
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.
It's not the same value, the second credentialsManager.credentials {
is another closure so the $0,$1 are different from the first closure.
credentials = Credentials(accessToken: AccessToken, tokenType: TokenType, idToken: IdToken, refreshToken: RefreshToken, expiresIn: Date(timeIntervalSinceNow: -3600)) | ||
_ = credentialsManager.store(credentials: credentials) | ||
waitUntil(timeout: 2) { done in | ||
credentialsManager.credentials { error = $0; newCredentials = $1 | ||
expect(error).to(beNil()) | ||
expect(newCredentials?.accessToken) == AccessToken | ||
expect(newCredentials?.accessToken) == NewAccessToken |
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.
idToken
will change too, as the dates change. You should test that too.
e757bc4
to
289f4e4
Compare
3aff521
to
0bc7f53
Compare
Added - Renewed credentials are autosaved in Credentials Manager