To obtain authorization for your app, you must create an authorization request link that you can send to users. The authorization flow begins by redirecting a browser to the authorization request link with a set of query parameters.
Prerequisites
Create the authorization request link
Authorization request link
Direct the user to the appropriate authorization url in a browser with the following URL query parameters appended in order to grant access:
https://app.marq.com/oauth2/authorizeAccount?response_type=code&client_id={required_client_id_value}&scope={required_scopes}&redirect_uri={required_redirect_uri_value}&state={optional_state_value}
Account vs User Token URLs
As a reminder, there are two different Access tokens that can be used with Marq REST APIS:
- Account (
https://app.marq.com/oauth2/authorizeAccount
)- User (
https://app.marq.com/oauth2/authorize
)To ensure your app obtains the correct token type, you will need to utilize the correct authorization URL
Authorization request link with line breaks
(We've added line breaks for better readability. Delete the line breaks for actual use.)
https://app.marq.com/oauth2/authorizeAccount?response_type=code
&client_id={required_client_id_value}
&scope={required_scopes}
&redirect_uri={required_redirect_uri_value}
&state={optional_state_value}
Encoded URLs
Make sure to encode the URL as part of your parameter to resolve correctly.
e.g.
https://app.marq.com/oauth2/authorizeAccount?...&redirect_uri=https://users.app.marq.com/oauth2/clients/fCWlNdTt-rRw6k9W0SETKRZkN3bqGRv5vUtV2oH7/redirect
should be updated to when sending a user to the authorization flow
https://app.marq.com/oauth2/authorizeAccount?response_type=code&client_id=fCWlNdTt-rRw6k9W0SE...&redirect_uri=https%3A%2F%2Fusers.app.marq.com%2Foauth2%2Fclients%2FfCWlNdTt-rRw6k9W0SETKRZkN3bqGRv5vUtV2oH7%2Fredirect
Authorization URL Query Parameters
Query Parameter | Sample |
---|---|
response_type required Indicates the response type. As we use the authorization code grant type, set the response_type query parameter value to code`. | code |
clientid required The Client ID of the app that is requesting for user authorization. To obtain your client ID: in Marq, go to your apps. Then, in the Created apps section, click the app for which you want to obtain the Client ID. The Client ID appears in the App Credentials section. | FNNquD2RZCYUZvImHkwnd-CKFfqQKlKX2OP-c392 |
scope required The scope of permissions the app is requesting access to leverage when interacting with each REST endpoint | project.templates%20account.user |
redirecturi required The URI of the page that you want to load after the user completed authorization. The URL must match the URL configured in the App Settings page. | https://localhost:3000 |
state optional Optional OAuth 2.0 state parameter. Can be any value that will be included in the redirect back to the app once authorization is completed. For request-specific data, you can use the state parameter to store data that will be included after the user is redirected. | 123xyz |