Skip to content

Commit

Permalink
Update example
Browse files Browse the repository at this point in the history
  • Loading branch information
noppoMan committed May 31, 2017
1 parent 5144ca5 commit c7ca427
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ let facebookProvider = FacebookAuthenticationProvider(
path: "/auth/facebook",
consumerKey: ProcessInfo.processInfo.environment["FACEBOOK_APP_ID"] ?? "",
consumerSecret: ProcessInfo.processInfo.environment["FACEBOOK_APP_SECRET"] ?? "",
callbackURL: "\(APP_URL)/auth/facebook/callback",
callbackURL: CallbackURL(baseURL: APP_URL, path: "/auth/facebook/callback"),
scope: "public_profile"
) { credential, request, context in

// here is called when the access_token got successfully from sns.

return Response(body: "\(credential)")
}

Expand Down Expand Up @@ -125,7 +125,7 @@ public protocol OAuth2AuthentitionProvidable {
var path: String { get } // path for authorize
var oauth: OAuth2 { get }
var callback: RespodWithCredential { get } // callback for success handler
init(path: String, consumerKey: String, consumerSecret: String, callbackURL: String, scope: String, callback: @escaping RespodWithCredential)
init(path: String, consumerKey: String, consumerSecret: String, callbackURL: CallbackURL, scope: String, callback: @escaping RespodWithCredential)
func getAccessToken(request: Request) throws -> Credential
}
```
Expand Down Expand Up @@ -166,7 +166,7 @@ let salesforceProvider = SalesforceAuthenticationProvider(
path: "/auth/salesforce",
consumerKey: "consumer",
consumerSecret: "secret",
callbackURL: "\(APP_URL)/auth/salesforce/callback",
callbackURL: CallbackURL(baseURL: APP_URL, path: "/auth/salesforce/callback"),
scope: "public_profile"
) { credential, request, context in

Expand Down
8 changes: 4 additions & 4 deletions Sources/HexavilleAuthExample/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ let facebookProvider = FacebookAuthenticationProvider(
path: "/auth/facebook",
consumerKey: ProcessInfo.processInfo.environment["FACEBOOK_APP_ID"] ?? "",
consumerSecret: ProcessInfo.processInfo.environment["FACEBOOK_APP_SECRET"] ?? "",
callbackURL: "\(APP_URL)/auth/facebook/callback",
callbackURL: CallbackURL(baseURL: APP_URL, path: "/auth/facebook/callback"),
scope: "public_profile"
) { credential, request, context in
return Response(body: "\(credential)")
Expand All @@ -30,7 +30,7 @@ let githubProvider = GithubAuthenticationProvider(
path: "/auth/github",
consumerKey: ProcessInfo.processInfo.environment["GITHUB_APP_ID"] ?? "",
consumerSecret: ProcessInfo.processInfo.environment["GITHUB_APP_SECRET"] ?? "",
callbackURL: "\(APP_URL)/auth/github/callback",
callbackURL: CallbackURL(baseURL: APP_URL, path: "/auth/github/callback"),
scope: "user,repo"
) { credential, request, context in
return Response(body: "\(credential)")
Expand All @@ -40,7 +40,7 @@ let googleProvider = GoogleAuthenticationProvider(
path: "/auth/google",
consumerKey: ProcessInfo.processInfo.environment["GOOGLE_APP_ID"] ?? "",
consumerSecret: ProcessInfo.processInfo.environment["GOOGLE_APP_SECRET"] ?? "",
callbackURL: "\(APP_URL)/auth/google/callback",
callbackURL: CallbackURL(baseURL: APP_URL, path: "/auth/google/callback"),
scope: "https://www.googleapis.com/auth/drive"
) { credential, request, context in
return Response(body: "\(credential)")
Expand All @@ -50,7 +50,7 @@ let instagramProvider = InstagramAuthenticationProvider(
path: "/auth/instagram",
consumerKey: ProcessInfo.processInfo.environment["INSTAGRAM_APP_ID"] ?? "",
consumerSecret: ProcessInfo.processInfo.environment["INSTAGRAM_APP_SECRET"] ?? "",
callbackURL: "\(APP_URL)/auth/instagram/callback",
callbackURL: CallbackURL(baseURL: APP_URL, path: "/auth/instagram/callback"),
scope: "basic"
) { credential, request, context in
return Response(body: "\(credential)")
Expand Down

0 comments on commit c7ca427

Please sign in to comment.