AlexanderYW / adonis-ally-azure-ad

MIT License
5 stars 4 forks source link

AAD & AADConfig #7

Open florianchevallier opened 1 year ago

florianchevallier commented 1 year ago

Hey !

Thank you for this package.

I'm trying to use it but I'm struggling with the integration :

import { AAD, AADConfig } from 'adonis-ally-azure-ad/build/standalone'

image

Cause, indeed, the build folder doesn't exist and I don't have any access to any type.

Could you help me on that ?

To give you more insight, here are the commands I launched :

yarn create adonis-ts-app azure-ad # here I chose "api" type
cd azure-ad
npm i @adonisjs/ally
npm i adonis-ally-azure-ad 
node ace configure adonis-ally-azure-ad

Thanks !

kenlane33 commented 1 year ago

I was able to import AAD like this: import { AAD } from 'adonis-ally-azure-ad/build/src/AzureAD'

Then I dug around in the commits and see the export of AADConfig is deleted in this commit: https://github.com/AlexanderYW/adonis-ally-azure-ad/commit/e4bf29b61ef4a9a4d846b3f291a192a109c53ba4

I jammed the deleted code directly into contracts/ally.ts (naughty):

import { LiteralStringUnion } from '@ioc:Adonis/Addons/Ally'
export type AADScopes = string
export type AADConfig = {
  driver: 'AzureAD'
  clientId: string
  clientSecret: string
  callbackUrl: string
  authorizeUrl?: string
  accessTokenUrl?: string
  userInfoUrl?: string
  scopes?: LiteralStringUnion<AADScopes>[]
}

and then I was able to configure as the instructions.md described:

declare module '@ioc:Adonis/Addons/Ally' {
  interface SocialProviders {
    // ... other mappings
    AzureAD: {
      config: AADConfig
      implementation: AAD
    }
  }
}

I think the standalone folder was forgotten in the later commits, perhaps?

AlexanderYW commented 1 year ago

Sorry, for the late response, I'm on paternity leave and have alot to deal with (The kid, house and insurance claims). but I'm getting some more free time now.

I quickly looking into this, and yes it seems like the types are not exported within the build/standalone, but I believe I have a fix for it. Just need to test it out, and when it's tested, I will release a hotfix I hope you guys are up for testing :)

AlexanderYW commented 1 year ago

Checkout the latest version 0.3.1 :)