Allows any Mendix application to gain access to any BYU API
Documentation
Description
This module allows applications to access API that have been published on the BYU API Store.
Typical Usage Scenario
You would use this module when you want to get the contact information for a student. This module will facilitate that process of communicating with the BYU API endpoint. If you're hitting an API that has been published on the BYU API Store then you will need to use this module.
How to Use
Navigate to the folder _USE_ME / Pages
Add the OAuth_Configuration snippet to a page
Each application will have a Client ID and a Client Secret which allow you to get a client token. The client token allows you to receive information from an individual API
Note: There are two grant types. Refer to the section "Grant Types" for specific instructions.
The "Client Token" represents the client credentials grant type. When using this method you only need to input the Client ID and Client Secret.
The "Personal Tokens" represents the authorization code grant type. When using this method you need to input the Callback URI as well.
To find the Client ID and Client Secret go to the BYU API store
Login using your BYU Net ID
Navigate to the My Subscriptions tab
Here you will find the Consumer Key, Consumer Secret, and Access Token
Enter the Consumer Key as the Client ID
Enter the Consumer Secret as the Client Secret
Click save
Click Get Client Token and it will generate a token
Grant Types
Currently, this module supports two OAuth 2.0 grant types:
Authorization Code
Calls an API on behalf of the user
Client Credentials
Calls an API on behalf of the application
Each grant type has a unique set of instructions. This section will show you how to use the given microflows and snippets for each grant type.
Authorization Code (Personal Tokens):
Add "ASu_PersonalToken_StartCallbackRH" to a startup microflow
Add the snippet "OAuth_RedirectForPersonalTokenMaybe" to the home page. After logging in, the user will be redirected to get their personal token.
Add "ACT_PersonalToken_GetToken" before making the REST request.
Client Credentials (Client Token):
Add "ACT_ClientToken_GetToken" before making the REST request
Download the module here. It will save as BYUOpenAuthentication.mpk
Note: If you are using Mendix Studio Pro 8.8.* or 8.9.* downloading private app store modules/widgets was turned off due to security concerns. All the BYU Private App Store content can still be downloaded from the Company Content page in the Mendix App Store and then imported into those versions of Studio Pro. Upgrading to a newer version of Mendix Studio Pro fixes the problem.
After the download finishes, import BYU Open Authentication into your project.
Right click on your Project Explorer
Select Import Module Package
Select the module you just downloaded and click Open