File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -289,9 +289,10 @@ public function getAccessToken(): ?AccessToken
289
289
* Get the url to redirect users to when setting up a salesforce access token
290
290
*
291
291
* @param string $redirectUrl
292
+ * @param string|null $state
292
293
* @return string
293
294
*/
294
- public function getLoginUrl (string $ redirectUrl ): string
295
+ public function getLoginUrl (string $ redirectUrl, ? string $ state = null ): string
295
296
{
296
297
$ params = [
297
298
'client_id ' => $ this ->clientConfig ->getClientId (),
@@ -300,7 +301,12 @@ public function getLoginUrl(string $redirectUrl): string
300
301
'grant_type ' => 'authorization_code '
301
302
];
302
303
303
- return rtrim ($ this ->clientConfig ->getLoginUrl (), '/ ' ) . '/services/oauth2/authorize? ' . http_build_query ($ params );
304
+ if (null !== $ state ) {
305
+ $ params ['state ' ] = $ state ;
306
+ }
307
+
308
+ return rtrim ($ this ->clientConfig ->getLoginUrl (), '/ ' ) . '/services/oauth2/authorize? ' .
309
+ http_build_query ($ params , '' , '& ' , PHP_QUERY_RFC1738 );
304
310
}
305
311
306
312
/**
You can’t perform that action at this time.
0 commit comments