Feature/change auth endpoint from get to post (#1823)
* Change auth endpoint from GET to POST * Login with security token * Login with Internet Identity * Update changelog
This commit is contained in:
parent
d55c052f57
commit
b74a042da8
@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
- Changed the `auth` endpoint of the login with _Security Token_ from `GET` to `POST`
|
||||||
|
- Changed the `auth` endpoint of the _Internet Identity_ login provider from `GET` to `POST`
|
||||||
- Improved the content of the Frequently Asked Questions (FAQ) page
|
- Improved the content of the Frequently Asked Questions (FAQ) page
|
||||||
- Improved the content of the pricing page
|
- Improved the content of the pricing page
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ import {
|
|||||||
Controller,
|
Controller,
|
||||||
Get,
|
Get,
|
||||||
HttpException,
|
HttpException,
|
||||||
Param,
|
|
||||||
Post,
|
Post,
|
||||||
Req,
|
Req,
|
||||||
Res,
|
Res,
|
||||||
@ -33,13 +32,13 @@ export class AuthController {
|
|||||||
private readonly webAuthService: WebAuthService
|
private readonly webAuthService: WebAuthService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
@Get('anonymous/:accessToken')
|
@Post('anonymous')
|
||||||
public async accessTokenLogin(
|
public async accessTokenLogin(
|
||||||
@Param('accessToken') accessToken: string
|
@Body() body: { accessToken: string }
|
||||||
): Promise<OAuthResponse> {
|
): Promise<OAuthResponse> {
|
||||||
try {
|
try {
|
||||||
const authToken = await this.authService.validateAnonymousLogin(
|
const authToken = await this.authService.validateAnonymousLogin(
|
||||||
accessToken
|
body.accessToken
|
||||||
);
|
);
|
||||||
return { authToken };
|
return { authToken };
|
||||||
} catch {
|
} catch {
|
||||||
@ -81,13 +80,13 @@ export class AuthController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get('internet-identity/:principalId')
|
@Post('internet-identity')
|
||||||
public async internetIdentityLogin(
|
public async internetIdentityLogin(
|
||||||
@Param('principalId') principalId: string
|
@Body() body: { principalId: string }
|
||||||
): Promise<OAuthResponse> {
|
): Promise<OAuthResponse> {
|
||||||
try {
|
try {
|
||||||
const authToken = await this.authService.validateInternetIdentityLogin(
|
const authToken = await this.authService.validateInternetIdentityLogin(
|
||||||
principalId
|
body.principalId
|
||||||
);
|
);
|
||||||
return { authToken };
|
return { authToken };
|
||||||
} catch {
|
} catch {
|
||||||
|
@ -388,9 +388,9 @@ export class DataService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public loginAnonymous(accessToken: string) {
|
public loginAnonymous(accessToken: string) {
|
||||||
return this.http.get<OAuthResponse>(
|
return this.http.post<OAuthResponse>(`/api/v1/auth/anonymous`, {
|
||||||
`/api/v1/auth/anonymous/${accessToken}`
|
accessToken
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public postAccess(aAccess: CreateAccessDto) {
|
public postAccess(aAccess: CreateAccessDto) {
|
||||||
|
@ -30,9 +30,9 @@ export class InternetIdentityService implements OnDestroy {
|
|||||||
const principalId = authClient.getIdentity().getPrincipal();
|
const principalId = authClient.getIdentity().getPrincipal();
|
||||||
|
|
||||||
this.http
|
this.http
|
||||||
.get<OAuthResponse>(
|
.post<OAuthResponse>(`/api/v1/auth/internet-identity`, {
|
||||||
`/api/v1/auth/internet-identity/${principalId.toText()}`
|
principalId: principalId.toText()
|
||||||
)
|
})
|
||||||
.pipe(
|
.pipe(
|
||||||
catchError(() => {
|
catchError(() => {
|
||||||
reject();
|
reject();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user