@@ -732,6 +732,16 @@ @implementation MainViewController {
732
732
@brief The continue URL to be used in the next action code request.
733
733
*/
734
734
NSURL *_actionCodeContinueURL;
735
+
736
+ /* * @var _googleOAuthProvider
737
+ @brief OAuth provider instance for Google.
738
+ */
739
+ FIROAuthProvider *_googleOAuthProvider;
740
+
741
+ /* * @var _microsoftOAuthProvider
742
+ @brief OAuth provider instance for Microsoft.
743
+ */
744
+ FIROAuthProvider *_microsoftOAuthProvider;
735
745
}
736
746
737
747
/* * @fn initWithNibName:bundle:
@@ -744,6 +754,8 @@ - (id)initWithNibName:(nullable NSString *)nibNameOrNil bundle:(nullable NSBundl
744
754
_actionCodeContinueURL = [NSURL URLWithString: KCONTINUE_URL];
745
755
_authStateDidChangeListeners = [NSMutableArray array ];
746
756
_IDTokenDidChangeListeners = [NSMutableArray array ];
757
+ _googleOAuthProvider = [FIROAuthProvider providerWithProviderID: FIRGoogleAuthProviderID];
758
+ _microsoftOAuthProvider = [FIROAuthProvider providerWithProviderID: @" microsoft.com" ];
747
759
[[NSNotificationCenter defaultCenter ] addObserver: self
748
760
selector: @selector (authStateChangedForAuth: )
749
761
name: FIRAuthStateDidChangeNotification
@@ -1782,7 +1794,7 @@ - (void)signInGoogleAndRetrieveData {
1782
1794
}
1783
1795
1784
1796
- (void )signInGoogleProvider {
1785
- FIROAuthProvider *provider = [FIROAuthProvider providerWithProviderID: FIRGoogleAuthProviderID] ;
1797
+ FIROAuthProvider *provider = _googleOAuthProvider ;
1786
1798
provider.customParameters = @{
1787
1799
@" prompt" : @" consent" ,
1788
1800
};
@@ -1816,7 +1828,7 @@ - (void)signInGoogleProvider {
1816
1828
@brief Invoked when "Sign in with Google (headful-lite)" row is pressed.
1817
1829
*/
1818
1830
- (void )signInGoogleHeadfulLite {
1819
- FIROAuthProvider *provider = [FIROAuthProvider providerWithProviderID: FIRGoogleAuthProviderID] ;
1831
+ FIROAuthProvider *provider = _googleOAuthProvider ;
1820
1832
provider.customParameters = @{
1821
1833
@" prompt" : @" consent" ,
1822
1834
};
@@ -1850,7 +1862,7 @@ - (void)signInGoogleHeadfulLite {
1850
1862
@brief Invoked when "Sign in with Microsoft (headful-lite)" row is pressed.
1851
1863
*/
1852
1864
- (void )signInMicrosoftHeadfulLite {
1853
- FIROAuthProvider *provider = [FIROAuthProvider providerWithProviderID: @" microsoft.com " ] ;
1865
+ FIROAuthProvider *provider = _microsoftOAuthProvider ;
1854
1866
provider.customParameters = @{
1855
1867
@" prompt" : @" consent" ,
1856
1868
@" login_hint" :
@" [email protected] " ,
0 commit comments