Skip to content
Revant Nandgaonkar edited this page Mar 22, 2020 · 4 revisions

Install

# install app in bench
bench get-app https://github.com/revant/oauth2_client
# install app on site
bench --site <site-name> install-app oauth2_client

Setup

  • Register the client on your authorization server of choice.
  • Add Connected App Entry
  • Easiest way to fill up the form is by querying openid-configuration endpoint
  • Fill the configuration endpoint and click get Get OpenID Configuration.
  • Note the redirect URL (Must be registered on Authorization server)

Usage

Create the object of connected app

connected_app = frappe.get_doc("Connected App", "bloomstack")

Get Client Token

client_token = connected_app.get_client_token()
print(client_token.access_token) # use the token 

Get User Token (Beta)

ConnectedApp.get_user_token() returns url string if no token was found, redirect user to initiate authorization code flow

It will return the valid token if previous token was found

user_token = connected_app.get_user_token()

API

Clone this wiki locally