{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-products/nowinfinity/resources/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"OAuth 2.0 Authorisation Code Grant Flow – NowInfinity API","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"oauth-20-authorisation-code-grant-flow--nowinfinity-api","__idx":0},"children":["OAuth 2.0 Authorisation Code Grant Flow – NowInfinity API"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This article provides a detailed overview of the Authorisation Code Grant Flow for integrating with the NowInfinity API, including step-by-step instructions, example requests, and error handling."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Authorisation Code Grant Flow is the preferred and most secure method to access the NowInfinity API. This flow ensures that sensitive credentials remain confidential and supports secure token exchange for accessing user data."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"flow-overview","__idx":1},"children":["Flow Overview"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Authorisation Code Grant Flow consists of the following steps:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Request Authorisation Code:"]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},"The client redirects the end-user to the NowInfinity authorisation server to request permission to access the user’s data."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["User Grants Permission:"]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},"Upon successful login, the user grants permission, and the authorisation server returns a unique code to the client via the redirect URI."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Exchange Code for Token:"]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},"The client sends the authorisation code to the authorisation server to exchange it for a JWT security token."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Access API:"]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},"The client uses the JWT token to access the NowInfinity API on behalf of the user."]}]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-1-request-authorisation-code","__idx":2},"children":["Step 1: Request Authorisation Code"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Redirect the end-user to the NowInfinity authorisation server:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"https://auth.nowinfinity-test.com.au/connect/authorize\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Query Parameters:"]}]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Example Value"},"children":["Example Value"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["client_id"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Identifies your application"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Provided by NowInfinity"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["redirect_uri"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["URI to return the user after authentication"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Determined by your application"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["response_type"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["OAuth flow type (must be ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["code"]},")"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["code"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["scope"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Space-delimited list of requested scopes"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["api1 offline_access read write"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["state"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Optional CSRF token for request/response correlation"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Unique GUID or identifier"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["display"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Optional: UI display mode (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["popup"]}," or omit)"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["popup"]}," (for popup UI), omit for normal page"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Example URL:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"https://auth.nowinfinity-test.com.au/connect/authorize?client_id=my_client_id&redirect_uri=http%3A%2F%2Fmysite.com&response_type=code&scope=api1%20offline_access%20read%20write\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If all parameters are correct, the user will see a login form.",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},"If incorrect credentials are provided, an error message will be displayed."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["After login, the user is prompted to grant permission to your application."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-2-exchange-authorisation-code-for-security-token","__idx":3},"children":["Step 2: Exchange Authorisation Code for Security Token"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Send a POST request to exchange the authorisation code for a JWT token:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"https://auth.nowinfinity-test.com.au/connect/token\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Form Fields:"]}]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Example Value"},"children":["Example Value"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["grant_type"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Purpose of request (must be ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["authorization_code"]},")"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["authorization_code"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["client_id"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Your application’s client ID"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Provided by NowInfinity"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["client_secret"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Your application’s client secret"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Provided by NowInfinity"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["redirect_uri"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Same redirect URI as in Step 1"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Same as Step 1"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["code"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Authorisation code from Step 1"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Received from redirect"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Example Successful Response:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"access_token\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6...\",\n  \"expires_in\": 360,\n  \"token_type\": \"Bearer\",\n  \"refresh_token\": \"222f4988703c8a36b8bcd4191b776063\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Example Error Response:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"error\": \"invalid_grant\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"summary","__idx":4},"children":["Summary"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Use the Authorisation Code Grant Flow for secure, server-side integrations with NowInfinity."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Always keep your ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["client_secret"]}," confidential."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Follow the step-by-step process for requesting and exchanging tokens."]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If you need further assistance or integration support, please contact partners@class.com.au"]}]},"headings":[{"value":"OAuth 2.0 Authorisation Code Grant Flow – NowInfinity API","id":"oauth-20-authorisation-code-grant-flow--nowinfinity-api","depth":1},{"value":"Flow Overview","id":"flow-overview","depth":2},{"value":"Step 1: Request Authorisation Code","id":"step-1-request-authorisation-code","depth":2},{"value":"Step 2: Exchange Authorisation Code for Security Token","id":"step-2-exchange-authorisation-code-for-security-token","depth":2},{"value":"Summary","id":"summary","depth":2}],"frontmatter":{"seo":{"title":"OAuth 2.0 Authorisation Code Grant Flow – NowInfinity API"}},"lastModified":"2025-12-03T04:34:29.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/products/nowinfinity/resources/authorisation-code-flow","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}