Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/yellow-squids-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@asgardeo/javascript': minor
'@asgardeo/react': minor
---

Update post login/signin callback url for V2
4 changes: 2 additions & 2 deletions packages/javascript/src/api/v2/executeEmbeddedSignInFlowV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ const executeEmbeddedSignInFlowV2 = async ({
const flowResponse: EmbeddedSignInFlowResponseV2 = await response.json();

// IMPORTANT: Only applicable for Asgardeo V2 platform.
// Check if the flow is complete and has an assertion and authId is provided, then call OAuth2 authorize.
// Check if the flow is complete and has an assertion and authId is provided, then call OAuth2 auth callback.
if (flowResponse.flowStatus === EmbeddedSignInFlowStatusV2.Complete && (flowResponse as any).assertion && authId) {
try {
const oauth2Response: Response = await fetch(`${baseUrl}/oauth2/authorize`, {
const oauth2Response: Response = await fetch(`${baseUrl}/oauth2/auth/callback`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down
4 changes: 2 additions & 2 deletions packages/javascript/src/api/v2/executeEmbeddedSignUpFlowV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ const executeEmbeddedSignUpFlowV2 = async ({
const flowResponse: EmbeddedSignUpFlowResponseV2 = await response.json();

// IMPORTANT: Only applicable for Asgardeo V2 platform.
// Check if the flow is complete and has an assertion and authId is provided, then call OAuth2 authorize.
// Check if the flow is complete and has an assertion and authId is provided, then call OAuth2 auth callback.
if (flowResponse.flowStatus === EmbeddedSignUpFlowStatusV2.Complete && (flowResponse as any).assertion && authId) {
try {
const oauth2Response: Response = await fetch(`${baseUrl}/oauth2/authorize`, {
const oauth2Response: Response = await fetch(`${baseUrl}/oauth2/auth/callback`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down
2 changes: 1 addition & 1 deletion packages/javascript/src/models/v2/embedded-flow-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ export interface EmbeddedFlowExecuteRequestConfig<T = any> extends EmbeddedFlowE
*
* When the embedded flow completes successfully and returns an assertion,
* this authId is used to complete the OAuth2 authorization flow by calling
* the `/oauth2/authorize` endpoint. This enables seamless transition from
* the `/oauth2/auth/callback` endpoint. This enables seamless transition from
* embedded flow to traditional OAuth2 flow completion.
*
* @example "auth_abc123def456"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ const SignIn: FC<SignInProps> = ({className, size = 'medium', onSuccess, onError
}

if (response.flowStatus === EmbeddedSignInFlowStatusV2.Complete) {
// Get redirectUrl from response (from /oauth2/authorize) or fall back to afterSignInUrl
// Get redirectUrl from response (from /oauth2/auth/callback) or fall back to afterSignInUrl
const redirectUrl = (response as any)?.redirectUrl || (response as any)?.redirect_uri;
const finalRedirectUrl = redirectUrl || afterSignInUrl;

Expand Down
Loading