CredentialsGitHub
public class CredentialsGitHub : CredentialsPluginProtocol
Authentication using GitHub web login with OAuth. See GitHub manual for more information.
-
The URL that GitHub redirects back to.
Declaration
Swift
public var callbackUrl: String -
The User-Agent to be passed along on GitHub API calls. User-Agent must be set in order to access GitHub API (i.e., to get user profile). See GitHub manual for more information.
Declaration
Swift
public private(set) var userAgent: String { get } -
The name of the plugin.
Declaration
Swift
public let name: String -
An indication as to whether the plugin is redirecting or not.
Declaration
Swift
public let redirecting: Bool -
User profile cache.
Declaration
Swift
public var usersCache: NSCache<NSString, BaseCacheElement>? -
A delegate for
UserProfilemanipulation.Declaration
Swift
public let userProfileDelegate: UserProfileDelegate? -
Initialize a
CredentialsGitHubinstance.Declaration
Swift
public init(clientId: String, clientSecret: String, callbackUrl: String, userAgent: String? = nil, options: [String : Any] = [:])Parameters
clientIdThe Client ID of the app in the GitHub Developer applications.
clientSecretThe Client Secret of the app in the GitHub Developer applications.
callbackUrlThe URL that GitHub redirects back to.
-
Authenticate incoming request using GitHub web login with OAuth.
Declaration
Swift
public func authenticate (request: RouterRequest, response: RouterResponse, options: [String:Any], onSuccess: @escaping (UserProfile) -> Void, onFailure: @escaping (HTTPStatusCode?, [String:String]?) -> Void, onPass: @escaping (HTTPStatusCode?, [String:String]?) -> Void, inProgress: @escaping () -> Void)Parameters
requestThe
RouterRequestobject used to get information about the request.responseThe
RouterResponseobject used to respond to the request.optionsThe dictionary of plugin specific options.
onSuccessThe closure to invoke in the case of successful authentication.
onFailureThe closure to invoke in the case of an authentication failure.
onPassThe closure to invoke when the plugin doesn’t recognize the authentication data in the request.
inProgressThe closure to invoke to cause a redirect to the login page in the case of redirecting authentication.
View on GitHub
CredentialsGitHub Class Reference