-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Description
Lines 42 to 65 in 16a77ce
func setToken(clientID, clientSecret string, accessToken *string) error { | |
repeatCount := 3 | |
i := 0 | |
if *accessToken == "" { | |
for i < repeatCount { | |
tokenMap, err := requestToken(clientID, clientSecret) | |
if err != nil { | |
return err | |
} | |
if token, ok := tokenMap["access_token"]; ok { | |
*accessToken = token.(string) | |
} | |
if *accessToken != "" { | |
break | |
} | |
time.Sleep(time.Millisecond * 20) | |
i++ | |
} | |
} | |
return nil | |
} |
requestToken()
결과가 200 OK 가 아니면 무조건 최대 3회까지 재 요청을 해야함.
3회 이후 토큰을 가져오지 못한 상태로 API 요청 후 서버에서 내려주는 에러 응답 결과를 사용자에게 보여주기 위함.
Metadata
Metadata
Assignees
Labels
No labels