Skip to content
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

Remove OAuth client and migrate functionality to static methods. #12

Merged
merged 2 commits into from
Dec 30, 2015

Conversation

paulyoung
Copy link
Contributor

This is the first part to what was outlined in #11 (comment).

@nickvelloff please review 🙏

@@ -2,6 +2,7 @@ import Swish

/// An API client for Passport.
public struct APIClient {
static let auth = Swish.APIClient()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This name is probably a bit misleading since it's really for making unauthorized requests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you would name it. client is pretty generic.

@nickvelloff
Copy link
Contributor

Hold the phone @paulyoung I see something to take a look at...

@nickvelloff
Copy link
Contributor

Check out https://github.com/nickvelloff/Disc/blob/login-logout/Disc/Networking/Resources/User/LoginIdentity.swift#L36-L80
As this was tested and worked properly for login.

context("not specifying scopes or a provider") {
it("should result in login URL") {
let url = oauth.createLoginUrl()
let url = APIClient.createLoginUrl(clientId: clientId, redirectUri: redirectUri)

let expectedUrlString = "https://passport.thegrid.io/login/authorize"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the old endpoint (OAuth passport) URL

@paulyoung
Copy link
Contributor Author

This doesn't address any of the new functionality, only what already existed.

createLoginUrl returns an NSURL that can be used with a web view.

Make sense?

@paulyoung
Copy link
Contributor Author

I planned to create another pull request for the new endpoints.

@nickvelloff
Copy link
Contributor

Ohh got it. Cool then it looks great. 🚢

paulyoung added a commit that referenced this pull request Dec 30, 2015
Remove OAuth client and migrate functionality to static methods.
@paulyoung paulyoung merged commit c58da83 into master Dec 30, 2015
@paulyoung paulyoung deleted the remove-oauth-client branch December 30, 2015 01:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants