Get a read-only token for a member's account through an OAuth 2.0 authorization-code flow with PKCE.
Lets a third-party site get a read-only token for a member's account without the member copying one by hand. It is an OAuth 2.0 authorization-code flow with PKCE (S256).
- Generate a random
code_verifier(43-128 characters) and astate, and keep both on your server. Thecode_challengeis the base64url-encoded SHA-256 of the verifier, without padding. - Send the member to
https://versedb.com/connectwithredirect_uri,state,code_challenge,code_challenge_method=S256, and optionallyclient_name(your app, such asWordPress, 40 characters at most),site_name(100 at most) andscope(a space-separated subset ofread:public read:showcase; both by default).redirect_urimust be HTTPS, orhttp://localhostwhile developing. - The member signs in if needed and approves or denies. VerseDB redirects to
redirect_uriwithcodeandstate, or witherror=access_deniedandstatewhen they deny. Check thatstatematches. - Within 5 minutes, exchange the code at
POST /api/v1/connect/tokenfrom your server.
The token is named "{client_name}: {your host}", lasts 365 days, shows in the member's My Apps
page and counts toward their limit of 10 active tokens. Connecting the same site again replaces
its previous token. read:showcase reads the member's profile, collection, wishlist, pull list and
reading progress for display, without email, birth date, location, prices, notes, storage or loans.