Generate an Access Token
client_id
and client_secret
, in order to generate an Access Token for a Public App you need to perform the following steps: redirect your users to the Authorization URL, retrieve the code, exchange it for an access token. Let's do this step by step.Redirect users to the Authorization URL
https://lnk.bio/manage/access?response_type=code&client_id={client_id}&redirect_uri={urlencoded_redirect}&scope=basic&state={variable_state}
{client_id}
the App Client Id you obtained when you created the app{urlencoded_redirect}
one of your Redirect URIs{variable_state}
a security variable that should change with each request and be verified from your backend to mitigate CSRF attacksRetrieve the Code
code
and state
code
is a unique, one-time code that you can use to exchange for an access tokenstate
refers to the previous variable you passed to the Authorization URL. Your backend should verify it's the same.https://yourdomain.com/integrations/lnk.bio?code=35475d6ff85842ccbb8d218e2f5e54bbf6d51779&state=134545
code
would be 35475d6ff85842ccbb8d218e2f5e54bbf6d51779
Exchange the Code for an Access Token
code
you can use it to request a new access_token
from the /oauth/token
endpoint.curl -u client_id:client_secret https://lnk.bio/oauth/token -d "grant_type=authorization_code&code={code}"
{"access_token":"ce7d13459ce5046ae78646d17a0550b809b7435e","expires_in":3600,"token_type":"Bearer","scope":"basic","refresh_token":"a9daea7ae107c7e734e502d6dd9a843282a2a3b9"}
access_token
part and you can start authenticating your calls to the Lnk.Bio APIs adding the access_token in the Authorization: Bearer
header of your calls.curl -H 'Authorization: Bearer ce7d13459ce5046ae78646d17a0550b809b7435e' https://lnk.bio/oauth/v1/me
Modified at 2024-04-16 08:36:18