@@ -46,8 +46,8 @@ func (a *Auth) Login(ctx context.Context, localPhone string, otpCallback OTPCall
4646 },
4747 }
4848
49- userAgent := []string {"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36" }
50- clientID := "e7126474617aa39eb9e484233c9b0649"
49+ userAgent := []string {config . AuthUserAgent }
50+ clientID := config . ClientID
5151
5252 log .Println ("[Login] Requesting OTP..." )
5353 reqBody1 := []byte ("" )
@@ -56,8 +56,8 @@ func (a *Auth) Login(ctx context.Context, localPhone string, otpCallback OTPCall
5656 "Accept" : []string {"application/json" },
5757 "Dnt" : []string {"1" },
5858 "Sec-Ch-Ua-Mobile" : []string {"?0" },
59- "Origin" : []string {"https://my.telkomsel.com" },
60- "Referer" : []string {"https://my.telkomsel.com /" },
59+ "Origin" : []string {config . LoginURL },
60+ "Referer" : []string {config . LoginURL + " /" },
6161 "Sec-Fetch-Site" : []string {"same-site" },
6262 "Sec-Fetch-Mode" : []string {"cors" },
6363 "Sec-Fetch-Dest" : []string {"empty" },
@@ -71,7 +71,7 @@ func (a *Auth) Login(ctx context.Context, localPhone string, otpCallback OTPCall
7171 "Priority" : []string {"u=1, i" },
7272 }
7373
74- authURL := "https://ciam.telkomsel.com/ iam/v1/realms/tsel /authenticate?authIndexType=service&authIndexValue=phoneLogin"
74+ authURL := fmt . Sprintf ( "%s/ iam/v1/realms/%s /authenticate?authIndexType=service&authIndexValue=phoneLogin", config . CiamBaseURL , config . CiamRealm )
7575
7676 req1 , _ := http .NewRequestWithContext (ctx , "POST" , authURL , bytes .NewReader (reqBody1 ))
7777 req1 .Header = headers1
@@ -136,9 +136,9 @@ func (a *Auth) Login(ctx context.Context, localPhone string, otpCallback OTPCall
136136 "Accept" : []string {"application/json" },
137137 "Dnt" : []string {"1" },
138138 "Sec-Ch-Ua-Mobile" : []string {"?0" },
139- "Origin" : []string {"https://my.telkomsel.com" },
140- "Referer" : []string {"https://my.telkomsel.com /" },
141- "Am-Clientid" : []string {clientID },
139+ "Origin" : []string {config . LoginURL },
140+ "Referer" : []string {config . LoginURL + " /" },
141+ "Am-Clientid" : []string {config . ClientID },
142142 "Content-Type" : []string {"application/json" },
143143 "Sec-Fetch-Site" : []string {"same-site" },
144144 "Sec-Fetch-Mode" : []string {"cors" },
@@ -184,17 +184,17 @@ func (a *Auth) Login(ctx context.Context, localPhone string, otpCallback OTPCall
184184
185185 log .Println ("[Login] Authorizing..." )
186186 authzParams := url.Values {}
187- authzParams .Add ("client_id" , clientID )
187+ authzParams .Add ("client_id" , config . ClientID )
188188 authzParams .Add ("nonce" , "true" )
189- authzParams .Add ("redirect_uri" , "https://my.telkomsel.com/web/callback" )
189+ authzParams .Add ("redirect_uri" , config . RedirectURI )
190190 authzParams .Add ("response_type" , "code" )
191191 authzParams .Add ("scope" , "profile openid phone identifier" )
192192
193- authzURL := "https://ciam.telkomsel.com/ iam/v1/oauth2/realms/tsel /authorize?" + authzParams .Encode ()
193+ authzURL := fmt . Sprintf ( "%s/ iam/v1/oauth2/realms/%s /authorize?%s" , config . CiamBaseURL , config . CiamRealm , authzParams .Encode () )
194194 headers3 := http.Header {
195195 "User-Agent" : userAgent ,
196196 "Accept" : []string {"application/json" },
197- "Referer" : []string {"https://my.telkomsel.com /" },
197+ "Referer" : []string {config . LoginURL + " /" },
198198 "Dnt" : []string {"1" },
199199 "Sec-Ch-Ua-Mobile" : []string {"?0" },
200200 "Sec-Ch-Ua" : []string {`"Not:A-Brand";v="99", "Google Chrome";v="145", "Chromium";v="145"` },
@@ -238,20 +238,20 @@ func (a *Auth) Login(ctx context.Context, localPhone string, otpCallback OTPCall
238238
239239 log .Println ("[Login] Requesting access token..." )
240240 tokenParams := url.Values {}
241- tokenParams .Add ("client_id" , clientID )
242- tokenParams .Add ("client_secret" , "P@ssw0rd" )
241+ tokenParams .Add ("client_id" , config . ClientID )
242+ tokenParams .Add ("client_secret" , config . ClientSecret )
243243 tokenParams .Add ("code" , code )
244244 tokenParams .Add ("grant_type" , "authorization_code" )
245- tokenParams .Add ("redirect_uri" , "https://my.telkomsel.com/web/callback" )
245+ tokenParams .Add ("redirect_uri" , config . RedirectURI )
246246 tokenParams .Add ("response_type" , "code" )
247247
248- tokenURL := "https://ciam.telkomsel.com/ iam/v1/oauth2/realms/tsel /access_token?" + tokenParams .Encode ()
248+ tokenURL := fmt . Sprintf ( "%s/ iam/v1/oauth2/realms/%s /access_token?%s" , config . CiamBaseURL , config . CiamRealm , tokenParams .Encode () )
249249
250250 headers4 := http.Header {
251251 "User-Agent" : userAgent ,
252252 "Accept" : []string {"application/json" },
253- "Origin" : []string {"https://my.telkomsel.com" },
254- "Referer" : []string {"https://my.telkomsel.com /" },
253+ "Origin" : []string {config . LoginURL },
254+ "Referer" : []string {config . LoginURL + " /" },
255255 "Content-Type" : []string {"application/x-www-form-urlencoded" },
256256 "Content-Length" : []string {"0" },
257257 "Dnt" : []string {"1" },
0 commit comments