@@ -12,20 +12,22 @@ public class SelectAuthMethodScript : MonoBehaviour
12
12
[ SerializeField ] private Text Output ;
13
13
[ SerializeField ] private Button UseDeviceCodeAuthButton ;
14
14
[ SerializeField ] private Button UsePKCEButton ;
15
- string REDIRECT_URI = null ;
16
- string LOGOUT_REIDIRECT_URI = "https://www.immutable.com" ;
15
+ string redirectUri = null ;
16
+ string logoutRedirectUri = "https://www.immutable.com" ;
17
+ string clientId = "ZJL7JvetcDFBNDlgRs5oJoxuAUUl6uQj" ;
17
18
#pragma warning restore CS8618
18
19
void Start ( )
19
20
{
20
21
#if UNITY_WEBGL
21
- string url = Application . absoluteURL ;
22
- Uri uri = new Uri ( url ) ;
23
- string scheme = uri . Scheme ;
24
- string hostWithPort = uri . IsDefaultPort ? uri . Host : $ "{ uri . Host } :{ uri . Port } ";
25
- string fullPath = uri . AbsolutePath . EndsWith ( "/" ) ? uri . AbsolutePath : uri . AbsolutePath . Substring ( 0 , uri . AbsolutePath . LastIndexOf ( '/' ) + 1 ) ;
22
+ string url = Application . absoluteURL ;
23
+ Uri uri = new Uri ( url ) ;
24
+ string scheme = uri . Scheme ;
25
+ string hostWithPort = uri . IsDefaultPort ? uri . Host : $ "{ uri . Host } :{ uri . Port } ";
26
+ string fullPath = uri . AbsolutePath . EndsWith ( "/" ) ? uri . AbsolutePath : uri . AbsolutePath . Substring ( 0 , uri . AbsolutePath . LastIndexOf ( '/' ) + 1 ) ;
26
27
27
- REDIRECT_URI = $ "{ scheme } ://{ hostWithPort } { fullPath } callback.html";
28
- LOGOUT_REIDIRECT_URI = $ "{ scheme } ://{ hostWithPort } { fullPath } logout.html";
28
+ redirectUri = $ "{ scheme } ://{ hostWithPort } { fullPath } callback.html";
29
+ logoutRedirectUri = $ "{ scheme } ://{ hostWithPort } { fullPath } logout.html";
30
+ clientId = "UnB98ngnXIZIEJWGJOjVe1BpCx5ix7qc" ;
29
31
#endif
30
32
31
33
// Determine if PKCE is supported based on the platform
@@ -34,7 +36,7 @@ void Start()
34
36
// If PKCE is not supported, initialise Passport to use Device Code Auth
35
37
if ( ! SampleAppManager . SupportsPKCE )
36
38
{
37
- InitialisePassport ( redirectUri : REDIRECT_URI , logoutRedirectUri : LOGOUT_REIDIRECT_URI ) ;
39
+ InitialisePassport ( ) ;
38
40
}
39
41
}
40
42
@@ -56,7 +58,7 @@ private bool IsPKCESupported()
56
58
public void UseDeviceCodeAuth ( )
57
59
{
58
60
SampleAppManager . UsePKCE = false ;
59
- InitialisePassport ( redirectUri : REDIRECT_URI , logoutRedirectUri : LOGOUT_REIDIRECT_URI ) ;
61
+ InitialisePassport ( ) ;
60
62
}
61
63
62
64
/// <summary>
@@ -65,17 +67,13 @@ public void UseDeviceCodeAuth()
65
67
public void UsePKCE ( )
66
68
{
67
69
SampleAppManager . UsePKCE = true ;
68
- InitialisePassport ( redirectUri : REDIRECT_URI , logoutRedirectUri : LOGOUT_REIDIRECT_URI ) ;
70
+ InitialisePassport ( ) ;
69
71
}
70
72
71
73
/// <summary>
72
74
/// Initialises Passport.
73
75
/// </summary>
74
- /// <param name="redirectUri">(Android, iOS and macOS only) The URL to which auth will redirect the browser after
75
- /// authorisation has been granted by the user</param>
76
- /// <param name="logoutRedirectUri">The URL to which auth will redirect the browser
77
- /// after log out is complete</param>
78
- private async void InitialisePassport ( string redirectUri = null , string logoutRedirectUri = null )
76
+ private async void InitialisePassport ( )
79
77
{
80
78
ShowOutput ( "Initialising Passport..." ) ;
81
79
@@ -85,7 +83,6 @@ private async void InitialisePassport(string redirectUri = null, string logoutRe
85
83
Passport . LogLevel = LogLevel . Info ;
86
84
87
85
// Initialise Passport
88
- string clientId = "ZJL7JvetcDFBNDlgRs5oJoxuAUUl6uQj" ;
89
86
string environment = Immutable . Passport . Model . Environment . SANDBOX ;
90
87
91
88
Passport passport = await Passport . Init ( clientId , environment , redirectUri , logoutRedirectUri ) ;
0 commit comments