...
- User is logged into Ecochain and clicks the 3rd party app launch button
Frontend logic will open a new browser tab and send a GET request to our internal web controller - Our web controller will authenticate the user against the API server and receive an access token
Our web controller will send a GET request with launch headers parameters to the launch URL of your app
E.g.Code Block curl -H "X-Ecochain-Access-Token: ABCDEF" -H "X-Ecochain-Expires-In: 3600" -H "X-Ecochain-Refresh-Token: GHIJKL" -H "X-Ecochain-Token-Type: Bearer" https: GET ‘https://acme.com/myproductspagelaunch?access_token=ABCDEF&expires_in=3600&refresh_token=GHIJKL&token_type=Bearer
Your controller will extract the 4 headersparameters, and use the access token to make requests to the Ecochain API
E.g. First get the current user
Code Block curl -H "Authorization: Bearer ABCDEF" https://app.ecochain.com/api/v1/users/me
then get the current company
Code Block curl -H "Authorization: Bearer ABCDEF" https://app.ecochain.com/api/v1/companies/me
then get all products for the company
Code Block curl -H "Authorization: Bearer ABCDEF" https://app.ecochain.com/api/v1/companies/{companyId}/products
Your controller will render the page with contents fetched from the API
As you can see, we've made SSO really simple for 3rd party application developers.
All you need to do is expose an endpoint that can receive GET requests with the 4 launch headers parameters and render the user interface.