Can Auto-login from Kakao Talk feature be implemented using the Kakao SDK for JavaScript?

Hi
We are going to implement Kakao Sync for our website and use the Auto-login from Kakao Talk feature. In order to implement the Simple Login feature we will use the Kakao SDK for JavaScript.
So I can’t get how to implement the Auto-login from Kakao Talk if we use the Kakao SDK for JavaScript, there are only Web, Legacy Android and Legacy iOS chapters in Auto-login from Kakao Talk. Is these any way to do it with Kakao SDK for JavaScript or it’s only possible with the REST API?

Sincerely

hi, @krmarketingsupport

If you use the Javascript SDK “authorize” function on a mobile device with KakaoTalk installed, you will automatically log in as Talk.


Auto-login from Kakao Talk
This function works with Talk’s in-app browser. And the user who does not signup receives an error response.


You can use the JavaScript SDK “authorize” function to implement the features you want.

Hi tim.l,
Thank you for your reply!

The main reason why we want to use the Kakao SDK for JavaScript is the Simple Login, which, as you mentioned, allows to authenticate a user through Kakao Talk without inputting the Kakao Account information.
As it’s mentioned in JavaScript.Login we will need to set the “throughTalk” parameter to “true” to enable it:
Screenshot 2022-07-01 at 13.52.31

And this is clear to me.

In order to enable the Auto-login from Kakao Talk, as it’s said in the Web chapter, we must add prompt=none in the request if we checked that KAKAOTALK is included in UserAgent. But I can’t find the “prompt” parameter in JavaScript.Login, you can also check this on my above screenshot.
At the same time when I checked the Kakao.Auth.authorize() I noticed the “prompts” property:
Screenshot 2022-07-01 at 14.26.53

Do you know: Should I simple use “prompts” property and set it to “none” in order to make the Auto-login from Kakao Talk working with the Kakao SDK for JavaScript?

Sincerely

Hi, @krmarketingsupport

The main reason why we want to use the Kakao SDK for JavaScript is the Simple Login, which, as you mentioned, allows to authenticate a user through Kakao Talk without inputting the Kakao Account information.
As it’s mentioned in JavaScript.Login we will need to set the “throughTalk” parameter to “true” to enable it:

The throughTalk parameter is true by default, so you don’t need to set it.

In order to enable the Auto-login from Kakao Talk, as it’s said in the Web chapter, we must add prompt=none in the request if we checked that KAKAOTALK is included in UserAgent. But I can’t find the “prompt” parameter in JavaScript.Login, you can also check this on my above screenshot.
At the same time when I checked the Kakao.Auth.authorize() I noticed the “prompts” property:

The prompt=none parameter only works when your website is displayed in the in-app browser inside KakaoTalk. So there’s no need to set it up.

JavaScript | Kakao Developers JavaScript

You only need to invoke the function “Kakao.Auth.authorize()”.
SDK automatically processes it when Kakao Talk authentication is possible.

Kakao.Auth.authorize({
  redirectUri: '${REDIRECT_URI}'
});

Hi @tim.l
Thank you for your reply, but I think there is a misunderstanding.

I understand what is the Simple Login. Also I understand that if we use the Kakao SDK for JavaScript, then on mobile devices where Kakao Talk is installed users will be logged in without inputting the Kakao Account information.

But we also want our users to be automatically logged in if they accessing our website page in the in-app browser inside KakaoTalk. E.g. they received a message with a link to our website, once they click on it, they will see a website page in a logged-in state. This is what the Auto-login from Kakao Talk feature allows.
It is said in the documentation that the first step is to check if the user access the page through the Kakao Talk in-app browser (check if KAKAOTALK is included in UserAgent).
But Step 2 is " add the prompt parameter to the request of Getting authorization code API and set it to “none”"
What if we are using the Kakao SDK for JavaScript? How should we set the prompt=none? And is this even possible when we use the Kakao SDK for JavaScript?
If we don’t send the prompt=none, then we won’t get the consent_required error response and won’t understand that the page should be present to the user in a logged-out status.

Sincerely

the solution you need

if(/KAKAOTALK/i.test(navigator.userAgent)) {
  Kakao.Auth.authorize({
    redirectUri: '${REDIRECT_URI}',
    prompts: 'none'
  })
}

if you send it to prompt=none, It is authenticated by Kakao Talk, not by the user (it is possible because users have already logged in to Kakao Talk)

therefore, the user may automatically log in without entering the ID/PW.

if the user has not already joined, the error consent_required will be send to redirect_uri.

if the prompt is not used, an error does not occur.
if a login or service connection is required, the user must do it.

2개의 좋아요

@tim.l and @woody.ho, now it’s clear. Thank you very much for the clarification.

Sincerely