> ## Documentation Index
> Fetch the complete documentation index at: https://docs.morph-data.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Freee

## Connecting to Freee

For an overview of the connector, please refer to the following link.

* [Connecting to DB/SaaS](/docs/en/develop/guides/integration)

<Tabs>
  <Tab title="Dashboard">
    <Steps>
      <Step title="Create a Connector">
        Select the "Connectors" tab on the top page and press the "Create" button.

        <img src="https://mintcdn.com/queue-4c50ebb3/evgQaQjX53Vch8Y5/assets/images/docs/advanced/connectors/connect-data-platform-connection.png?fit=max&auto=format&n=evgQaQjX53Vch8Y5&q=85&s=19c6e7afc70da565c2a8ab4f75469549" alt="Connection" width="1907" height="711" data-path="assets/images/docs/advanced/connectors/connect-data-platform-connection.png" />
      </Step>

      <Step title="Enter Freee Credentials">
        Select Freee and press the sign-in button.

        <img src="https://mintcdn.com/queue-4c50ebb3/evgQaQjX53Vch8Y5/assets/images/docs/advanced/connectors/connect-data-platform-freee-create.png?fit=max&auto=format&n=evgQaQjX53Vch8Y5&q=85&s=d8f16b4485e000f2d128a49a0863da04" alt="Freee Connection Create" width="1692" height="787" data-path="assets/images/docs/advanced/connectors/connect-data-platform-freee-create.png" />

        After entering the information, press the Create button to complete the creation. If there are any errors in the parameters, an error message will be displayed, so please check the connection details again.
      </Step>

      <Step title="Retrieve access_token from the Created Connector">
        Once the creation is successful, you can retrieve the connector name from the list.

        Use the dedicated function to enter the connector name in the Python code and retrieve the access\_token.

        <CodeGroup>
          ```python Python theme={"dark"}
          import morph
          from morph import MorphGlobalContext
          from morph_lib.api import get_auth_token


          @morph.func
          def main(context: MorphGlobalContext):
              access_token = get_auth_token("connection_name")
              # ↓↓↓ Process using access_token ↓↓↓
          ```
        </CodeGroup>
      </Step>
    </Steps>
  </Tab>

  <Tab title="Local Version">
    <Info>In the local version, you currently need to directly write the credentials in `~/.morph/connections.yml`. Please create the connector in the dashboard if you prefer other methods.</Info>

    <Steps>
      <Step title="Edit connections.yml">
        If the file does not exist in `~/.morph/connections.yml`, please create it beforehand and then edit it.

        ```bash shell theme={"dark"}
        mkdir ~/.morph
        touch ~/.morph/connections.yml
        ```

        ```yaml theme={"dark"}
        connections:
          freee-connection: # Unique arbitrary name
            type: freee # Fixed
            method: freee_oauth # Fixed
            refresh_token: str
            client_id: str
            client_secret: str
            redirect_uri: str
            access_token: str # Optional
        ```
      </Step>

      <Step title="Use the Connector in Code to Retrieve Data">
        Use the dedicated function to enter the connector name in the Python code and retrieve the access\_token.

        <CodeGroup>
          ```python Python theme={"dark"}
          import morph
          from morph import MorphGlobalContext
          from morph_lib.api import get_auth_token


          @morph.func
          def main(context: MorphGlobalContext):
              access_token = get_auth_token("connection_name")
              # ↓↓↓ Process using access_token ↓↓↓
          ```
        </CodeGroup>
      </Step>
    </Steps>

    The refresh of the access\_token is a dashboard feature, so the one specified in the local environment will always be used.

    <Warning>
      When actually specifying the connector and executing the file, the priority is as follows.
      Also, please note that only connectors created in the dashboard can be used in the environment where `morph deploy` is performed.

      1. Connectors listed in `~/.morph/connections.yml` on the local machine
      2. Connectors registered in the cloud
    </Warning>
  </Tab>
</Tabs>
