Configuring OAuth2 - Google


 

OAuth2 is an authorization framework that enables users to access applications using accounts in Https based services such as Google, Facebook, Office 365 etc. It basically works by delegating user authentication to the service that host user accounts and authorizing third-party applications to access the user account information.

SapphireIMS supports user authentication using OAuth2 based services provided by Google, GSuite and Office 365.

This section provides details on configuring OAuth2 based services provided by Google.

 

Pre-Requisites for OAuth2 based authentication using Google

 

 

Setting up OAuth2 Google Service

 

SapphireIMS needs to be registered with the Google service. Upon registering Google will issue client credentials in the form of a client identifier (Client ID) and a client secret. The Client ID is a publicly exposed string that is used by the service to identify the application and is also used to build authorization URLs that are presented to users. The Client Secret is used to authenticate the identity of the application to the service  when the application make a request to access a user's account and must be kept private between the application and the service.

OAuth2-1.jpg

 

 

Oauth2-2.jpg

 

 

OAuth2-3.jpg

 

 

OAuth2-4a.jpg

 

OAuth2-4b.jpg

OAuth2-4c.jpg

 

OAuth2-11.jpg

OAuth2-8c.jpg

OAuth2-8d.jpg

 

OAuth2-8f.jpg

OAuth2-8e.jpg

OAuth2-5.jpg

 

 

OAuth2-6.jpg

 

 

OAuth2-7.jpg

 

 

Note.gifNote: You can leave the Authorized redirect URIs field blank for the initial configuration and update it later from the URI in SapphireIMS. Refer to the section on Adding Google IdP in SapphireIMS in SapphireIMS.

Note.gifNote: You can add multiple redirect URIs including one for the Mobile application or for other SapphireIMS instances in the same organization.

Note.gifNote: SapphireIMS Android app needs to be allowed in G-Suite workplace to enable users to authenticate using OAuth2.

 

OAuth2-10.jpg

 

 

Adding Google IdP in SapphireIMS

 

OAuth2-IdPList.jpg

 

OAuth2-BaseURL.jpg

Note.gifNote: For the mobile application use 'MobileApp' instead of 'SapphireIMS' in the base URL.

OAuth2-Idp1.jpg

 

OAuth2-AddIdP.jpg

 

 

Sr. No. Field Name Description

1

Identity Provider

Select the name of the identity provider as 'Google'.

 

2

Name

Enter a name for the IdP.

3

Alias

The alias uniquely identifies an identity provider and it is also used to build the redirect URI

 

4

Redirect URI

The Redirect URI is used by Google to redirect the user to the application after authentication. This is a display-only field and is generated using the Base URL and Alias.

Note.gifNote: Once the IdP is configured, this URI needs to be copied and pasted into the 'Authorized redirect URIs' field in 'OAuth Client ID' in the Google Console.

5

ClientID

Enter the Client ID generated by Google

6

Client secret

Enter the Client secret generated by Google

7

Default scopes

SapphireIMS can ask for the scopes for authorization which are entered here. By default if left blank, SapphireIMS requests for email, profile and openid which are minimally required. Note that in Google OAuth Consent screen, these scopes should have been present.

8

Enable

Enable/Disable this identity provider

 

9

Authenticate by Default

This setting needs to be enabled when the SapphireIMS login screen needs to be hidden. If enabled, on entering the SapphireIMS URL, it directly takes the user to the SapphireIMS home page if the user is already logged into Google or to the Google sign-in screen. By default, this is disabled.

10

Icon

Select the icon to click on the SapphireIMS login screen which will allow logging in via Google authentication. By default, the icon is set as Google.

11

Color

Select the color of the icon.