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

No option to use OAuth with sandbox accounts #102

Open
hassanakbar4 opened this issue Feb 27, 2024 · 1 comment
Open

No option to use OAuth with sandbox accounts #102

hassanakbar4 opened this issue Feb 27, 2024 · 1 comment

Comments

@hassanakbar4
Copy link

These URLs are for production accounts.

      SCOPE = "https://ads.microsoft.com/msads.manage"
      AUTHORIZE_URI = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize"
      TOKEN_URI = "https://login.microsoftonline.com/common/oauth2/v2.0/token"
      REDIRECT_URI = "https://login.microsoftonline.com/common/oauth2/nativeclient"

Instead of these, we need to add sandbox URLs based on :environment.

@danielmbarlow
Copy link
Contributor

Thanks for pointing that out. I was just reading authorization_handler.rb.

Just an idea, but maybe we could achieve that as follows:

  • Adding a parameter to the constructor (environment: :production for example), and saving to @environment
  • Adding a hash constant to AuthorizationHandler like this:
API_URLS = {
  production: {
    scope: "...."
    ... etc ...
  }
  sandbox: {
    ...
  }
}
  • Adding private methods for #scope, #authorize_url etc. to switch on @environment, maybe using API_URLS.dig(@environment, :scope) for example
  • Using those private methods wherever we used the constants before

Is anyone keen to submit a Pull Request for that feature? @hassanakbar4 maybe? Perhaps you could test your branch with your app and let us know how it goes

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

No branches or pull requests

2 participants