File tree Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Original file line number Diff line number Diff line change 11<?php
2-
32$ config = [
43 //main endpont:
5- "service " =>"__http ://SERVICE.ENDPOINT/__ " ,
6- //oauth endpoint:
7- "sso " =>"__http ://SERVICE.ENDPOINT/oauth__ " ,
8- "client_id " =>"__CLIENT_ID__ " ,
9- "client_secret " =>"__CLIENT_SECRET__ " ,
4+ "service " =>"http ://sandbox.fanapium.com:8080/ " ,
5+ " sso " => " http://sandbox.fanapium.com/oauth2/ " ,
6+ "sso_service " =>"http ://sandbox.fanapium.com/ " ,
7+ "client_id " =>"40f6433a961bc1aff11b5ba3 " ,
8+ "client_secret " =>"9bf8077e " ,
109 //the url of where this app is deployed
11- "home " =>"http://WHERE_THIS_CODE_DEPLOYED/ "
12- ];
10+ "home " =>"http://79.174.163.69/php-oauth-simple/ "
11+ ];
12+
13+
14+
15+
Original file line number Diff line number Diff line change 33session_start ();
44$ _SESSION ['keylead_code ' ]=$ _GET ['code ' ];
55
6- $ url = ' demo.fanapium.com:12594/oauth2 /token/ ' ;
6+ $ url = $ config [ ' sso ' ]. ' /token/ ' ;
77$ ch = curl_init ($ url );
88$ fields = "client_id= {$ config ['client_id ' ]}&client_secret= {$ config ['client_secret ' ]}&code= {$ _GET ['code ' ]}&redirect_uri= {$ config ['home ' ]}return.php&grant_type=authorization_code " ;
99curl_setopt ($ ch , CURLOPT_POSTFIELDS , $ fields );
1616$ _SESSION ['access_token ' ]= $ token ->access_token ;
1717$ _SESSION ['refresh_token ' ]= $ token ->refresh_token ;
1818
19- header ("Location: {$ config ['home ' ]}index.php " );
19+ header ("Location: {$ config ['home ' ]}index.php " );
You can’t perform that action at this time.
0 commit comments