simov / grant

OAuth Proxy
MIT License
4.08k stars 257 forks source link

Support Tiktok #269

Closed balmacefa closed 2 years ago

balmacefa commented 2 years ago

Hi! I'm trying to add Tiktok as a Provider But Tiktok is asking for client_key instead of client_id https://github.com/simov/grant/blob/101c95ebb105db2839336606912d35fe97ffd569/lib/flow/oauth2.js#L10

Is it possible to add this Provider?

Here is the doc from Tiktok: https://developers.tiktok.com/doc/login-kit-web

my config:

   {
    tiktok: {
      enabled: true,
      icon: 'cube',
      key: '',
      secret: '',
      callback: `${baseURL}/tiktok/callback`,
      scope: ['user.info.basic'],
      origin: 'https://open-api.tiktok.com',
      access_url:'https://open-api.tiktok.com/platform/oauth/connect',
      authorize_url:'https://open-api.tiktok.com/platform/oauth/connect',
      state: true,
      oauth:2,
      transport:'session'
    },
    }
simov commented 2 years ago

TikTok required some custom code because of using client_key instead of client_id as you suggested https://github.com/simov/grant/commit/ab036924441cf3c83b31cb8e293ed742f5d592de

Can you reference Grant in your package.json as:

"grant": "github:simov/grant"

and try again?

{
  "defaults": {
    "origin": "your app origin",
    "transport": "session"
  },
  "tiktok": {
    "key": "",
    "secret": "",
    "scope": [
      "user.info.basic"
    ],
    "state": true,
    "response": ["tokens", "raw", "profile"],
    "callback": "NOTE: this is NOT your OAuth redirect URI"
  }
}
balmacefa commented 2 years ago

Thanks! Looks great. Cannot confirm yet; need the approval of Tiktok for the redirect_uri (may take some days....) I'll update!

simov commented 2 years ago

My app got denied because of:

Your app was denied because it did not meet our requirements: Invalid URL.

I guess it's either because of the Privacy Policy one or the Terms of Service which I don't have either since this is only for testing.

simov commented 2 years ago

Published in v5.4.21

Let me know if you have any issues.