getProvider

AppDelegate.reachfive().getProvider(name)

Description

Retrieve a provider registered on the ReachFive client by name.

Refer at the iOS SDK Installation to initialize the providers at the client’s instantiation.

  • The scopes provided are the permissions setup in the provider’s configuration through the console.

Usage

When using the viewController property for .login, you must ensure that your UIViewController implements the ASWebAuthenticationPresentationContextProviding protocol.

To do this, add the following to your UIViewController:

func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor {
    view.window!
}

This is not applicable for .logout.

This only applies to providers that were not explicitly set in the provider list at configuration time.

Examples

  • Login

  • Logout

import Reach5

let providerName: String = // Here paste the name of the provider

let scope = ["openid", "email", "profile", "phone", "full_write", "offline_access"]

AppDelegate
    .reachfive()
    .getProvider(name: providerName)?
    .login(
        scope: scope,
        origin: "home",
        viewController: self
    )
    .onSuccess{ authToken in
        // Get the profile's authentication token
    }
    .onFailure { error in
        // Return a ReachFive error
    }
import Reach5

let providerName: String = // Here paste the name of the provider

AppDelegate
    .reachfive()
    .getProvider(name: providerName)?
    .logout()
    .onSuccess { _ in
        // Do something
    }
    .onFailure { error in
        // Return a ReachFive error
    }

Parameters

Parameter Description

name string

The name of the provider.

possible values
  • facebook

  • google

  • paypal

  • twitter

  • franceconnect

  • apple

  • oney

Response

Type: Provider

Provider

The provider which name matches the name passed in argument.

name string

The name of the provider.

possible values
  • facebook

  • google

  • paypal

  • twitter

  • franceconnect

  • apple

  • oney

login function

Expect the following arguments:

  • scope [String]: the list of the profile’s scopes. Make sure they are allowed by the client. Default scopes are the allowed scopes set up in the client’s configuration.

  • origin String: the origin of the call

  • viewController UIViewController: the class that manages the views of your iOS app.

It authenticates the profile with the provider otherwise it returns a ReachFiveError.

logout function

No argument is expected. Kill the SSO session of the profile otherwise returns a ReachFiveError.