In this video, we’re going to learn how to secure public API Key for third party providers from iOS or any front-end clients. We will use Firebase Cloud Functions for the HTTP endpoint and Firebase Authentication for managing users in client as well verify the user auth token in the server side.
#proxyserver #chatgpt #swiftlang #iosdevelopment
Timeline:
00:00:00 Introduction & Short Demo
00:04:30 Getting Started & Project Setup
00:06:27 Create & Setup Firebase Project with Functions & Emulator
00:10:20 Implement HTTP Endpoint Handler for Chat
00:24:00 Test Local Functions using CuRL
00:26:10 Using Google Secret Manager to secure API Key
00:31:44 Authenticate User using Firebase Admin Auth in Server
00:37:18 Add iOS App to Firebase Project
00:41:23 Handle Authentication State & UI when iOS App Start
00:47:33 Update XCAChatGPTAPI Swift file to use Firebase token to pass as Header
00:52:16 Test iOS App Chat prompt by hitting Local Functions
00:54:49 Deploy Functions HTTP to Cloud & Test on iOS App
00:56:56 Closing
Starter Project GitHub Repo:
https://github.com/alfianlosari/fireb...
Completed Project GitHub Repo:
https://github.com/alfianlosari/fireb...
XCA - Building Authentication in SwiftUI using Firebase Auth SDK & Sign in with Apple Article:
https://www.alfianlosari.com/posts/bu...
Firebase Website:
https://firebase.google.com
OpenAI Developer Website:
https://platform.openai.com/api-keys
Build ChatGPT SwiftUI App Playlist:
• Build ChatGPT SwiftUI Multiplatform A...