Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat header 에 token 적용 #42

Merged
merged 8 commits into from
May 21, 2022
Merged

feat header 에 token 적용 #42

merged 8 commits into from
May 21, 2022

Conversation

onemask
Copy link
Collaborator

@onemask onemask commented May 18, 2022

SharedPreference 에 token 값 저장하여
interceptor 이용하여 token 값 넣어주었습니다.

@onemask onemask requested a review from wjdwns May 18, 2022 16:01
@onemask onemask self-assigned this May 18, 2022
override fun onCreate() {
super.onCreate()
PrefsManager.init(applicationContext)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

datastore도 이런식으로 사용될 수 있는지에 대해 고민을 좀 해보아야하겠군요

@@ -102,6 +103,7 @@ class LoginFragment : Fragment() {
viewModel.response.collect { response ->
Timber.d("accesstoken:${response?.accessToken}, refreshtoken:${response?.refreshToken}")
response?.run {
PrefsManager.setTokens(response.accessToken, response.refreshToken)
DataStoreRepository(
DataStoreManager(requireContext())).saveAccessToken(
response.accessToken
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아래의 datastore코드는 일부러 남겨놓으신걸까요?

proceed(
request().newBuilder()
.addHeader("AUTHORIZATION", PrefsManager.accessToken)
.build()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

인터셉터 사용은 처음보는데 여러방면에서 사용하기 좋은놈이군요

@wjdwns
Copy link
Collaborator

wjdwns commented May 19, 2022

수고하셨습니다!

@sujin-kk sujin-kk merged commit 3272ac1 into develop May 21, 2022
@sujin-kk sujin-kk deleted the feature/add_interceptor branch May 21, 2022 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants