Tutorial: Signing in and out

Serverless Authentication Signing in and out

The Webcom Authentication Service provides a lot of authentication methods to sign users in to your applications.
By default, only the Webcom email-based login is enabled when creating a new Webcom application. In order to use other authentication methods, they must be explicitly enabled and setup in the "authentication" tab of the Webcom developer console. Also remember a sign-up is first mandatory to create the identity before the use of sign in method.

  • When using a Webcom Internal Provider, don't forget to sign a user up before attempting to sign her/him in! 😉
  • Once the user authenticated, if the network connection is lost, the Webcom SDK will automatically re-sign her/him in to your application as soon as the connectivity recovers.

Authentication methods classified by usage

Identity Provider Available Authentication methods
Webcom Internal Provider - Guest login
- Email-based login
- Phone-based login
- Server login
Orange Public Providers - Login with Orange France account
- Implicit mobile network-based login
Orange Corporate Providers - Orange Connect
- Orange Employee SSO login
Third-Party Providers - Login with Mobile Connect
- Login with Google
- Login with Facebook
- Login with Apple
- Login with Github
- Login with Gitlab
Customizable Third-Party Providers - Login with OIDC compliant providers
- Login with non standard providers

Authentication methods classified by implementation

Method Description
Guest login Authentication without creating an actual account. This method allows to protect users' data for the duration of a "guest" session only.
Webcom internal login Authentication based on email & password, or phone number & one time password.
Mobile implicit login Authentication based on the mobile device and the Orange mobile data network used.
OAuth2 login Authentication delegation to an OAuth2.0 compliant third-party identity provider.
Custom login Authentication delegation to an existing specific third-party authentication system. It allows to integrate with any other authentication component.
Server login Authentication of machine accounts, dedicated to back office operations and based on an RSA key pair-signed Json Web Token.

Sign out

The sign-out procedure is common to all authentication methods, it basically consists in "forgetting" the authentication state (and the associated Webcom token) locally on the device. This means that there is no interaction with the Webcom back end and no token is actually revoked. Therefore, the forgotten token is still valid and may be used further on any device.

The following example shows how to use the sign-out procedure (replace “<your-app>” with your actual application identifier):

// const app = Webcom.App("<your-app>"); // UNCOMMENT if you haven't yet an instance of your app!
// Get an instance of the authentication service
const auth = app.authentication;
// Sign out
    .then(() => console.log("Signed out successfully!"))
    .catch((error) => console.log("The sign out failed: " + error.message));
val myApp = WebcomApplication.default // the app defined by the 'webcom.properties' asset file
val authenticator = myApp.authenticationService

authenticator.unauthenticate { // it: WebcomResult<Unit>
    when (it) {
        is WebcomResult.Success -> print("sign out complete")
        is WebcomResult.Failure -> print("sign out failed: ${it.error.errorCode}")
let authenticationService = Webcom.defaultApplication.authenticationService
authenticationService.unauthenticate { result in
    switch result {
    case .success:
        print("Sign-out completed!")
    case let .failure(error):
        print("Failed to sign-out:", error)