Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: Modify access modifiers for config and request #64

Closed
wants to merge 1 commit into from

Conversation

ci0n
Copy link

@ci0n ci0n commented Jun 18, 2024

I encountered the same issue as #55, and I hope to extend the functionality of the SDK through the internal request method.

example:

import { SDK } from 'casdoor-nodejs-sdk';

export class Casdoor extends SDK {

  public async getAuthTokenByPassword(username: string, password: string) {
    if (!request) {
      throw new Error('request init failed')
    }

    const {
      data: { access_token, refresh_token },
    } = (await this.request.post('login/oauth/access_token', {
      client_id: this.config.clientId,
      client_secret: this.config.clientSecret,
      grant_type: 'password',
      username,
      password,
    })) as unknown as AxiosResponse<{
      access_token: string
      refresh_token: string
    }>

    return {
      access_token,
      refresh_token,
    }

  }

}

@casbin-bot
Copy link

@tangyang9464 @imp2002 please review

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


pzh seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@hsluoyz
Copy link
Member

hsluoyz commented Jun 18, 2024

Replaced by: 06989b1

@hsluoyz hsluoyz closed this Jun 18, 2024
@ci0n ci0n deleted the access-modifiers branch June 19, 2024 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants