Get authorization code API always return the Login form as default

Hi Kakao Dev team,
The issued access token will expire in a validity period (6 hours), so we need to refresh the access token by calling an API as Kakao provides in the document here REST API | Kakao Developers REST API

In order to re-issue a new access token I need to get the authorization code, I followed this document REST API | Kakao Developers REST API to obtain the authorization code but it doesn’t work for me.

It always responds with the status 200 OK and the login form without any errors although you pass an incorrect client_id.

Requests:
https://kauth.kakao.com/oauth/authorize?response_type=code&client_id=${REST_API_KEY}&redirect_uri=${REDIRECT_URI}

  • REST_API_KEY: [My Application]-> Click the application → [REST API key]
  • REDIRECT_URI: [My Application]-> Click the application → [Kakao login]-> [Redirect URI]

Can you correct me if any are incorrect?

Thanks in advance for your help,

Hi~

Tell me your app ID.
(My Application>App Settings>Summary > ID)

Hi @tim.l
My app ID is 847605.

Thanks for your support

I don’t see anything strange in the log.
Please tell me the URL where I can test it.

@tim.l
My URL is https://kauth.kakao.com/oauth/authorize?response_type=code&client_id=77c24aa04e4491504635c6022782bee0&redirect_uri=https://moment.kakao.com/oauth

image

“authorize” will be redirected to 302.
Please test it on the browser.

@tim.l it redirected KOE006 error as below
image

redirect_uri should use your system URL.

Please refer to the guide.

https://developers.kakao.com/docs/latest/en/kakaologin/common#oauth


KOE006 error occurs when using redirect_uri that is not registered in the developer settings.

https://developers.kakao.com/docs/latest/en/kakaologin/trouble-shooting#code


Kakao login is the same as normal OAuth2 authentication.

Thank you @tim.l , Is the authorization code permanently valid or just in the validity period?

Valid only once.

(When used to issue access tokens, the authentication code is discarded immediately.)

REST API | Kakao Developers REST API

Thank you, @tim.l how can I pass the user/pass to the URL? We have to do it manually or possible to pass it to the URL

Why deliver “user/pass”?
Social login is authenticated on the page provided by the certification company.
Do not forward “user/pass”.

Because when I test the URL in the browser which not login already in, it will be redirected to the login form.

To protect your account, you must log in directly.

I use the REST API to automatically connect and import report data from Kakao, I can’t every 6 hours login manually and get the authorization code

It is recommended that you renew the access token using the refresh token instead of requesting an authorization code every 6 hours.

REST API | Kakao Developers REST API

Is the refresh token valid for 1 month?
So in order to refresh the access token we need to do the following steps:

  1. Get the authorization code manually ( do every 1 month when the refresh token expires) → 2. call the refresh token every 6 hours → 3. Receive the new access token

The refresh token is valid for 2 months.
However, if you request a token renewal after one month, the refresh token will also be renewed. If the refresh_token is delivered in the response, the refresh token must be replaced.

  1. Get the authorization code manually ( do every 1 month when the refresh token expires) → 2. call the refresh token every 6 hours → 3. Receive the new access token (Update refresh token if Refresh_token is present in response)

@tim.l , Thank you so much. :grinning:

1개의 좋아요