Perform OpenID authentication
This commit is contained in:
		
							
								
								
									
										28
									
								
								remote_frontend/src/api/AuthApi.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								remote_frontend/src/api/AuthApi.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
import { APIClient } from "./ApiClient";
 | 
			
		||||
 | 
			
		||||
export class AuthApi {
 | 
			
		||||
  /**
 | 
			
		||||
   * Start OpenID login
 | 
			
		||||
   */
 | 
			
		||||
  static async StartOpenIDLogin(): Promise<{ url: string }> {
 | 
			
		||||
    return (
 | 
			
		||||
      await APIClient.exec({
 | 
			
		||||
        uri: "/auth/start_oidc",
 | 
			
		||||
        method: "GET",
 | 
			
		||||
      })
 | 
			
		||||
    ).data;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Finish OpenID login
 | 
			
		||||
   */
 | 
			
		||||
  static async FinishOpenIDLogin(code: string, state: string): Promise<void> {
 | 
			
		||||
    await APIClient.exec({
 | 
			
		||||
      uri: "/auth/finish_oidc",
 | 
			
		||||
      method: "POST",
 | 
			
		||||
      jsonData: { code: code, state: state },
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    window.location.href = "/";
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user