Switching Teams without Logging Out
  • 03 Aug 2023
  • 4 Minutes to read
  • Contributors
  • Dark
    Light

Switching Teams without Logging Out

  • Dark
    Light

Article summary

Past Behavior (Presence SDK)

The old Presence SDK only allowed a single Team login, along with a Host login.
This works fine any App that supports a single Team.

  • Bucks App only logs into a single Team, the Milwaukee Bucks
  • Bucks App only contains a single API Key, the key for the Milwaukee Bucks

This works fine, but what about an App that supports multiple teams?

  • A League App may want to support all teams in that league
  • A Venue App may want to support all teams that play at the Venue

In this case, the User must be logged out when switching Teams (changing API Keys):

  1. Configure Team1 API Key
  2. User logs into Team1
  3. User's Team1 tickets are fetched, user views Team1 tickets
  4. User switches to Team2
  5. User is logged out of Team1
  6. Configure Team2 API Key
  7. User logs into Team2,
  8. User's Team2 tickets are fetched, user views Team2 tickets
  9. User switches back to Team1
  10. User is logged out of Team2
  11. Go back to step 1

In the old Presence SDK, it is not possible to switch teams (change API Keys) without logging the user out first (steps 5 and 10).

Current Behavior (Tickets SDK)

The new Authentication SDK allows user to be logged into multiple Teams at once, without logging out.

  1. Configure Team1 API Key
  2. User logs into Team1
  3. User's Team1 tickets are fetched, user views Team1 tickets
  4. User switches to Team2
  5. Configure Team2 API Key
  6. User logs into Team2
  7. User's Team2 ticktets are fetched, user views Team2 tickets
  8. User switches back to Team1
  9. User is still logged into Team1
  10. User's Team1 tickets are fetched, user views Team1 tickets

The Tickets SDK currently only displays tickets for one Team at a time, but at least the user doesn't have to re-login when switching back to Team 1 (step 9).

There are some special considerations when using this mode:

  1. Developer must enable ephemeral web browser session
    1. TMAuthentication.shared.forceEphemeralWebBrowserSession = true
    2. TMAuthentication.Builder().forceNewSession(true)
    3. This prevents an issue where Team1's oauth token is returned to Team2 during login
    4. Unfortunately, this ALSO disables the shared login feature, where the user doesn't have to re-enter the username and password for Host (see Non-Ephemeral vs. Ephemeral Login below)
    5. This issue is not easily resolved
  2. Tickets SDK can currently only store one Team's tickets at a time
    1. While the user won't need to re-login, the user's Tickets will need to be refetched when switching teams (step 10 above) .
    2. This refetch is automatic and will require no extra coding effort on your part, but it is not an ideal user experience.
    3. This issue will be resolved in an upcoming release of Tickets SDK

Notice in the video how the user only has to log into each Team once.
Then the user can switch teams without having to re-login!
Example of being logged into 3 different Archtics Teams at once:

However, also notice that the tickets are refreshed/reloaded each time the Team is changed.

Future Improvements (Tickets SDK)

An upcoming version of Tickets SDK will store each team's Tickets independantly, resolving the above issue where the tickets must be refetched each time the user switches teams.

It may be possible to resolve the ephemeral web browser session issue, but we don't have a solution determined at this time.

Non-Ephemeral vs. Ephemeral Login

Non-Ephemeral

iOS:

TMAuthentication.shared.forceEphemeralWebBrowserSession = false

Android:

TMAuthentication.Builder()
    .apiKey("")
   ...
    .forceNewSession(false)
    .build()

By default, iOS uses a non-ephemeral Login web browser session. This means cookies are stored between sessions.
This is useful since we can re-use the user's Team Archtics login to also log into Ticketmaster Host.

Notice in the video how the user only has to enter their username and password once:

Ephemeral

iOS:

TMAuthentication.shared.forceEphemeralWebBrowserSession = true

Android:

TMAuthentication.Builder()
    .apiKey("")
   ...
    .forceNewSession(true)
    .build()

This means cookies are NOT stored in iOS between sessions.
This is useful since we avoid a bug where Team1's credentials are accidently returned to Team2.
But it also means the user has to log into Team Archtics and Host separately.

Notice in the video how the user has to enter their username and password twice:

The good news is that by using ephemeral web browser sessions, we can log the user into as many Team Archtics clients as we want!
Example of being logged into 3 different Archtics Teams at once:

Logout and multiple Teams

Currently, logout only logs the user out of the current Team.
However, it also logs the user out of Host. This is necessary since in order to "log out" we must clear all the user's currently viewed tickets for both Archtics and Host.

This means, that if the user tries to switch to a different Team, then the user will be asked to log back into Host.

Notice in the video that the user is logged out of both Broncos Team and Ticketmaster Host.
Then the user switches to Chiefs, and is asked to log back into Ticketmaster Host.

This may be the behavior you want.
Or maybe you'd prefer to simply show the user their Chiefs tickets with the option to log back into Host.

This is accomplished by turning off combined login:

TMAuthentication.shared.useCombinedLogin = false

Notice in the video that the user is logged out of both Broncos Team and Ticketmaster Host.
Then the user switches to Chiefs, and is shown their Chiefs Archtics tickets.
Finally, the user optionally logs back into Ticketmaster Host to see their Host tickets.

Keep in mind that most users NEVER log out of an Application.
They may delete the Application from their device, but the log out button is almost NEVER used by the average user.


Was this article helpful?