abp icon indicating copy to clipboard operation
abp copied to clipboard

move the oauth out of @abp/ng.core

Open snowchenlei opened this issue 4 years ago • 3 comments

Abp uses the oauth by default to login. However, in some scenarios, we do not use oauth, we use jwt instead. But when environment.oAuthConfig does not exist, it will get error Can you move the oauth related to a separate package?

snowchenlei avatar Sep 13 '21 03:09 snowchenlei

Yes this is quite easy to do.

One of the authors helped me to this replacement provider. Put this in your app module providers array:

        {
            provide: OAuthService,
            useValue: {
                hasValidAccessToken: () => true, // return token status
                configure: () => {
                },
                loadDiscoveryDocument: () => Promise.resolve(),
                events: of(),
                tryLogin: () => {
                },
                setupAutomaticSilentRefresh: () => {
                },
                getAccessToken: () => '' // return access token
            }
        },

I can tell you this works as this has been running in production like this.

davidzwa avatar Sep 14 '21 19:09 davidzwa

Thank you very much for your answer but now i use ng-alain This combination became difficult after 4.4

snowchenlei avatar Sep 16 '21 07:09 snowchenlei

I do agree with you that oAuth is quite hard to remove from the angular setup. But then I must also add that my setup (and yours) deviate quite a lot from the path that Abp has set out as default.

Hopefully the team and us can come to a good mid-way in this triage!

davidzwa avatar Sep 16 '21 18:09 davidzwa

we have removed authentication packages from the core. If you an ABP user want to implement your own authentication flow, the user can do it much easier. I also documented which function or interface should be overridden.

here the docs. https://github.com/abpframework/abp/pull/15261 here the PR. That feature released with v7.0.0-rc6. https://github.com/abpframework/abp/pull/15201

mahmut-gundogdu avatar Dec 29 '22 11:12 mahmut-gundogdu