ballerina-platform / ballerina-library

The Ballerina Library
https://ballerina.io/learn/api-docs/ballerina/
Apache License 2.0
137 stars 58 forks source link

Panic occurs when generating OAuth2 token with an invalid refresh token value #6724

Closed Nuvindu closed 2 weeks ago

Nuvindu commented 2 months ago

Description: When a gmail:Client is initialized with an invalid refresh token, a panic occurs instead of mapping the error value to the variable. That happens when oauth2 module tries to generate a token using that invalid refresh token value

Steps to reproduce:

  1. Create new Ballerina project
  2. Modify the main.bal file as below and run the project
import ballerinax/googleapis.gmail;

configurable string clientId = "client-id";
configurable string clientSecret = "client-secret";
configurable string refreshToken = "refresh-token";

public function main() {
    gmail:Client|error gmail = new ({
        auth: {
            clientId,
            clientSecret,
            refreshToken
        }
    });
}
MohamedSabthar commented 2 weeks ago

Hi @Nuvindu, This is not a bug but a design choice. We already have an issue for this: https://github.com/ballerina-platform/ballerina-library/issues/3494

github-actions[bot] commented 2 weeks ago

This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now.

      - Reason/EngineeringMistake - The issue occurred due to a mistake made in the past.
      - Reason/Regression - The issue has introduced a regression.
      - Reason/MultipleComponentInteraction - Issue occured due to interactions in multiple components.
      - Reason/Complex - Issue occurred due to complex scenario.
      - Reason/Invalid - Issue is invalid.
      - Reason/Other - None of the above cases.