class Fastlane::Actions::FirebaseAppDistributionLoginAction
Constants
- CLIENT_ID
In this type of application, the client secret is not treated as a secret. See: developers.google.com/identity/protocols/OAuth2InstalledApp
- CLIENT_SECRET
- OOB_URI
- SCOPE
Public Class Methods
description()
click to toggle source
@!group Documentation
# File lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_login.rb, line 41 def self.description "Authenticate with Firebase App Distribution using a Google account." end
details()
click to toggle source
# File lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_login.rb, line 45 def self.details "Log in to Firebase App Distribution using a Google account to generate an authentication "\ "token. This token is stored within an environment variable and used to authenticate with your Firebase project. "\ "See https://firebase.google.com/docs/app-distribution/ios/distribute-fastlane for more information." end
is_supported?(platform)
click to toggle source
# File lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_login.rb, line 55 def self.is_supported?(platform) [:ios, :android].include?(platform) end
run(params)
click to toggle source
# File lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_login.rb, line 16 def self.run(params) client_id = Google::Auth::ClientId.new(CLIENT_ID, CLIENT_SECRET) authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, nil) url = authorizer.get_authorization_url(base_url: OOB_URI) UI.message("Open the following address in your browser and sign in with your Google account:") UI.message(url) UI.message("") code = UI.input("Enter the resulting code here: ") credentials = authorizer.get_credentials_from_code(code: code, base_url: OOB_URI) UI.message("") UI.success("Set the refresh token as the FIREBASE_TOKEN environment variable") UI.success("Refresh Token: #{credentials.refresh_token}") rescue Signet::AuthorizationError UI.error("The code you entered is invalid. Copy and paste the code and try again.") rescue => error UI.error(error.to_s) UI.crash!("An error has occured, please login again.") end