Skip to content

Access token required, but not yet available when doing OAuth flow #179

@jcoenegrachts

Description

@jcoenegrachts

Describe the bug
We recently upgraded from version 17.1.0 to 43.0.0 and noticed that when you create a new SquareClient without a token specifically for using the OAuth API (like we did in the past) it throws an exception. "Please pass in token or set the environment variable SQUARE_TOKEN." This wasn't required in the past.

Expected behavior
I expected a SquareClient to be created without an access token to make use of the OAuth API.

To Reproduce
Steps to reproduce the bug:

  1. Create a new client without an access token and no SQUARE_TOKEN environment variable configured
  2. See exception
var client = new SquareClient(clientOptions: new ClientOptions { BaseUrl = "..." }); // this throws
await client.oAuthApi.ObtainTokenAsync(...); // code we were hoping to run to get an access token.

Screenshots
If applicable, add screenshots to help explain the bug.

Square SDK version
For example: 43.0.0

Additional context
We got around this issue by just entering an empty string as the token.

var client = new SquareClient(string.Empty, clientOptions: new ClientOptions { BaseUrl = "..." });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions