@@ -85,6 +85,11 @@ @interface FUIOAuth ()
85
85
*/
86
86
@property (nonatomic , copy , nullable ) NSDictionary <NSString *, NSString*> *customParameters;
87
87
88
+ /* * @property loginHintKey
89
+ @brief The key of the custom parameter, with which the login hint can be passed to the IdP.
90
+ */
91
+ @property (nonatomic , copy , nullable ) NSString *loginHintKey;
92
+
88
93
/* * @property provider
89
94
@brief The OAuth provider that does the actual sign in.
90
95
*/
@@ -101,7 +106,8 @@ - (instancetype)initWithAuthUI:(FUIAuth *)authUI
101
106
buttonColor : (UIColor *)buttonColor
102
107
iconImage : (UIImage *)iconImage
103
108
scopes : (nullable NSArray <NSString *> *)scopes
104
- customParameters : (nullable NSDictionary <NSString *, NSString*> *)customParameters {
109
+ customParameters : (nullable NSDictionary <NSString *, NSString*> *)customParameters
110
+ loginHintKey : (nullable NSString *)loginHintKey {
105
111
if (self = [super init ]) {
106
112
_authUI = authUI;
107
113
_providerID = providerID;
@@ -112,29 +118,11 @@ - (instancetype)initWithAuthUI:(FUIAuth *)authUI
112
118
_scopes = scopes;
113
119
_customParameters = customParameters;
114
120
_provider = [FIROAuthProvider providerWithProviderID: self .providerID];
115
- _provider.customParameters = self.customParameters ;
116
- _provider.scopes = self.scopes ;
121
+ _loginHintKey = loginHintKey;
117
122
}
118
123
return self;
119
124
}
120
125
121
- - (instancetype )initWithProviderID : (NSString *)providerID
122
- buttonLabelText : (NSString *)buttonLabelText
123
- shortName : (NSString *)shortName
124
- buttonColor : (UIColor *)buttonColor
125
- iconImage : (UIImage *)iconImage
126
- scopes : (nullable NSArray <NSString *> *)scopes
127
- customParameters : (nullable NSDictionary <NSString *, NSString*> *)customParameters {
128
- return [self initWithAuthUI: [FUIAuth defaultAuthUI ]
129
- providerID: providerID
130
- buttonLabelText: buttonLabelText
131
- shortName: shortName
132
- buttonColor: buttonColor
133
- iconImage: iconImage
134
- scopes: scopes
135
- customParameters: customParameters];
136
- }
137
-
138
126
#pragma mark - FUIAuthProvider
139
127
140
128
/* * @fn accessToken:
@@ -171,6 +159,17 @@ - (void)signInWithDefaultValue:(nullable NSString *)defaultValue
171
159
completion : (nullable FUIAuthProviderSignInCompletionBlock)completion {
172
160
self.presentingViewController = presentingViewController;
173
161
162
+ FIROAuthProvider *provider = self.provider ;
163
+ provider.scopes = self.scopes ;
164
+ NSMutableDictionary *customParameters = [NSMutableDictionary dictionary ];
165
+ if (self.customParameters .count ) {
166
+ [customParameters addEntriesFromDictionary: self .customParameters];
167
+ }
168
+ if (self.loginHintKey .length && defaultValue.length ) {
169
+ customParameters[self .loginHintKey] = defaultValue;
170
+ }
171
+ provider.customParameters = [customParameters copy ];
172
+
174
173
[self .provider getCredentialWithUIDelegate: nil
175
174
completion: ^(FIRAuthCredential *_Nullable credential,
176
175
NSError *_Nullable error) {
0 commit comments