actbase / react-kakaosdk Goto Github PK
View Code? Open in Web Editor NEWKakaoSDK Bridge for React, React-Native, RNW
License: MIT License
KakaoSDK Bridge for React, React-Native, RNW
License: MIT License
[발생]
ios에서 로그인시에 카카오톡 실행후 다시 앱으로 전환하나 토큰을 반환하지 않습니다.
[환경]
xcode 13.1
react": "17.0.2",
react-native": "0.66.0",
kakaosdk version : 2.6.0
[info.plist]
kakao{kakaoKey}
kakaokompassauth
kakaolink
kakaotalk-5.9.7
kakaonavi-sdk
[실행코드]
await KakaoSDK.init(kakaoKey)
const tokens = await KakaoSDK.login()
.then((result) => {
console.log(Login Finished:${JSON.stringify(result)}
);
resolve(true)
}).catch((error) => {
console.log(Login Cancelled:${error}
);
resolve(false)
});
console.log('tokens',tokens);
[xcode log]
2021-11-22 04:44:02962 [💬][AuthController.swift 99:25] -> 카카오톡 실행: kakaokompassauth://authorize?params=%7B%22code_challenge_method%22:%22S256%22,%22code_challenge%22:%224yXUp5rK1qxFPwEzLKsjOzwC9BvXSwVoOoZ2fLkbueM%22%7D&client_id={kakaoKey}&redirect_uri=kakao{kakaoKey}://oauth&headers=%7B%22KA%22:%22sdk%5C/2.5.6%20sdk_type%5C/swift%20os%5C/ios-15.1%20lang%5C/ko-KR%20res%5C/390x844%20device%5C/iPhone%20origin%5C/앱번들%20app_ver%5C/1.0%22%7D&response_type=code
#4
해당 링크를 참조하여 진행을 해보았지만 똑같은 현상이 발생합니다.
getAccessToken의 AccessTokenType이 아래와 같이 뜹니다.
{"access_token": undefined, "expires_in": NaN, "refresh_token": undefined, "refresh_token_expires_in": NaN, "scopes": undefined}
login의 AccessTokenType는 위와 같은 현상 없이 정상적으로 나옵니다.
무엇이 문제일까요?
`
const kakaoLogin = async () => {
try {
await KakaoSDK.init("")
const tokens = await KakaoSDK.login();
console.log("토큰 시작")
console.log(tokens);
const profile = await KakaoSDK.getProfile();
console.log(profile);
if(tokens.access_token) {
return setSns({
type : "kakao",
token : tokens.access_token
});
}
} catch (e) {
console.log("카카오에러 ");
console.log(e);
}
}`
해당코드로 확인하면 토큰발급은 확인되는데 getProfile에서 앱이 꺼져버리는데 혹시 이유를 알 수 있을까요??
현재 앱 키는 네이티브 앱 키를 사용하고 있으며,
해당 키로 안드로이드는 잘 작동하고 있습니다.
IOS 등록도 Bundle Identifier 에 있는 이름을 사용하고 있고요.
AppDelegate.m 에는 openURL:(NSURL *)url 이 빠져있어 임의로 추가 후 if문을 추가한다면 스플래쉬 화면 이후 검은 화면이 뜹니다.
안내해주신 설정(자동설정 및 README 안내)은 다 적용하여 빌드 후 앱 재 실행하여 로그인 등 정상 동작 전부 확인하였습니다.
[환경]
xcode 13.1
react": "17.0.2",
react-native": "0.66.2",
@actbase/react-kakaosdk: "0.9.19"
RN에서 ios빌드 시 아래 에러가 발생합니다.
failed to verify module interface of 'RNAKakaoSDK' due to the errors above; the textual interface may be broken by project issues or a compiler bug
mac os - 14.1.1
xcode - 15.0.1
RN - 0.68.5
kakaosdk version : 2.5.6
카카오톡 실행은 되지만 로그인에서 실패함
react native 프로젝트에서 openChannelChat 호출시
RNAKakaoSDK.openChannelChat is not a function, 이라는 type error 노출됩니다.
#17
XCode 14버전에서 빌드시 에러가 나서 최신 SDK로 교체 하는 걸 기대하는데.... 계획이 있으신가요?
Got error when try installing the library to React-Native App (Expo-bared). Here's the error log
/Users/thor/.npm/_npx/dc46b1f2346da22f/node_modules/@actbase/react-kakaosdk/bin/install:46
exec(cmd?.replace(/\n/g, ' '), (err, stdout, stderr) => {
^
SyntaxError: Unexpected token '.'
at wrapSafe (internal/modules/cjs/loader.js:1047:16)
at Module._compile (internal/modules/cjs/loader.js:1097:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47
리액트 네이티브 환경에서 getAccessToken를 사용한 경우 에러가 발생합니다.
에러 메시지입니다.
[TypeError: str.replace is not a function. (In 'str.replace(' ', 'T')', 'str.replace' is undefined)]
구현 코드입니다.
`export async function getAccessToken () {
KakaoSDK.getAccessToken()
.then((res) => {
console.log('getAccessToken res: ', res)
})
.catch((err) => {
console.log('getAccessToken err: ', err)
})
}`
getAccessToken가 아닌 login, getProfile은 정상작동하는 상황입니다.
안녕하세요,
이번에 사업자 등록을 변경하면서 리액트네이티브 키를 변경하게 됐는데요,
그래서 npx @actbase/react-kakaosdk 설치를 새로운 키로 다시 했는데
완료는 됐지만,
Android 설치 시작
- AndroidManifest.xml 수정
AuthCodeHandlerActivity 가 존재합니다. 키를 확인해주세요.================================================
설치완료..
라고 뜹니다.
<activity android:name="com.kakao.sdk.auth.AuthCodeHandlerActivity" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:host="oauth" android:scheme="kakao~~~~~~"/>
</intent-filter>
</activity>
AndroidManifest 파일에서 저 물결 부분만 제대로 고쳐주면 되는거 맞나요?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.