IT討論區(93) 跳糟跳著份伏工,伏到訓覺都叫春

1001 回覆
2 Like 1 Dislike
2020-08-27 14:23:22
唔係send request 俾server side做handle?
2020-08-27 14:30:45
ok, 咁我backend handle左 http://mydomain.com/?token=xxxxx

咁之後我redirect番user去http://mydomain.com(frontend)?frontend/user點知自己登入左

第三日學web
2020-08-27 14:38:22
2020-08-27 15:06:48
sor可能我自己都唔知自己做緊咩
我reference緊
https://printmyroute.xyz/

我一禁connect with strava,就離開左原來個網,去左strava既auth

而我一authorize左,就被redirect左去
https://printmyroute.xyz/activity/?state=&code=xxxxxxxxxxx&scope=read,activity:read_all,profile:read_all,read_all


我拎住條code=xxxxxxxxxxx,就可以拎晒user係strava上面既資料

但係我唔知應該點handle https://printmyroute.xyz/activity/?state........
呢條url,令到個frontend知道登入左

之後我一直9 search諗會唔會係用react router食條url呢......?
2020-08-27 15:07:14
2020-08-27 15:10:06
token會擺落local-storage
睇下人地點用jwt先啦你似乎真係基本都未識
2020-08-27 15:10:18
2020-08-27 15:13:34
2020-08-27 15:39:01
想問下
如果我有個api想做到localhost get佢既時候會顯示多d野
其他人有無可能用fake ip扮localhost偷睇我d野?
2020-08-27 15:39:32
你應該係講緊auth完之後既動作?
簡單set 一個 var, e.g. is_authed = true; 之後再用簡單
conditional rendering
return (
{ (is_authed) }  ? <YouComponent> : <div> you have not logged in yet</div>
)

類似係咁
想有系統D就 整兩套routes 一個係public 一個係private
private要 user auth左先可以入/睇到, public 就唔洗

token 係用front end send 野去backend先要用 or同其他app做communication先要用, 你拎完條TOKEN之後store in localstorage, CALL API果陣一再PASS條TOKEN過去
2020-08-27 15:40:49
師兄屌得好,我搵到啦
https://www.graphql.college/implementing-github-oauth-flow/


window.location.href.match(/?code=(.*)/)

佢用呢句食番個code
2020-08-27 15:49:55
你拎完條TOKEN之後store in localstorage:

岩岩搵到
window.location.href.match(/?code=(.*)/)
save低個auth code,再exchange token,
之後再save落local storage?
2020-08-27 15:51:53
2020-08-27 16:01:27
2020-08-27 16:06:31
X-Http-Forwarded-For: 127.0.0.1
2020-08-27 16:07:47
試下吹relational algebra
2020-08-27 16:09:30
2020-08-27 16:11:14
2020-08-27 16:12:11
2020-08-27 16:12:19
你係整緊social login?
2020-08-27 16:15:57
整緊個web app 扲strava跑步data搞D野
初初諗住自己用
2020-08-27 16:16:49
咁都係set password算
2020-08-27 16:24:05
Why not both
Localhost && (cookie has correct password || manual input correct password)
2020-08-27 16:24:50
巴打有detail嗎?
上過去, office好細, 聽聞D野一腳踢
吹水台自選台熱 門最 新手機台時事台政事台World體育台娛樂台動漫台Apps台遊戲台影視台講故台健康台感情台家庭台潮流台美容台上班台財經台房屋台飲食台旅遊台學術台校園台汽車台音樂台創意台硬件台電器台攝影台玩具台寵物台軟件台活動台電訊台直播台站務台黑 洞