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: use user_info API to check tokens DD-4674 #12

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dmitrytrager
Copy link
Contributor

@dmitrytrager dmitrytrager commented Jan 23, 2025

POST token_info method does not work for checking tokens because it requires access token specific to Account API (our stored tokens are specific to Marketing API). This PR introduces GET user_info method to check token's validity. After this change POST requests support is not needed and can be removed for now.

Examples:

irb(main):001> Panda::Client.new(TiktokProfile.last.token).token_info
(irb):1:in `<main>': Access token is incorrect or has been revoked. (Panda::NotAuthorizedError)

irb(main):002> Panda::Client.new(TiktokProfile.last.token).user_info
=>
#<Panda::UserInfo:0x00000001696ed4e8
 @data={"core_user_id"=>"715585...", "avatar_url"=>"", "display_name"=>"...", "email"=>"a***@revealbot.com", "create_time"=>1666121473}>

TT API: https://business-api.tiktok.com/portal/docs?id=1739665513181185

@dmitrytrager dmitrytrager marked this pull request as ready for review January 23, 2025 16:42
@dmitrytrager dmitrytrager requested a review from AlphaB January 23, 2025 18:41
Copy link
Member

@AlphaB AlphaB left a comment

Choose a reason for hiding this comment

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

I don't think we need to remove token_info method, it's a public gem after all :) We also might need token_info method in near future

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.

2 participants