firebase-authentication-dotnet icon indicating copy to clipboard operation
firebase-authentication-dotnet copied to clipboard

GitHub Authentication

Open tride258 opened this issue 4 years ago • 2 comments

Hello. I got an error when trying to authenticate via github. I added client id client secret github.com in Authorized domains callback url: https://demoexm-ec418.firebaseapp.com/__/auth/handler and created access token

Here is my code:

var authProvider = new FirebaseAuthProvider(new Firebase.Auth.FirebaseConfig("api"));
//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
var auth = await authProvider.SignInWithOAuthAsync(FirebaseAuthType.Github, "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");
firebaseClientAuth = new Firebase.Database.FirebaseClient(
                  "https://demoexm-ec418-default-rtdb.firebaseio.com/",
                  new FirebaseOptions
                  {
                      AuthTokenAsyncFactory = () => Task.FromResult(auth.FirebaseToken)
                  });```

I get this in response:

```Firebase.Auth.FirebaseAuthException: Exception occured while authenticating.
Url: https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyAssertion?key={0}
Request Data: {"postBody":"access_token=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&providerId=github.com","requestUri":"http://localhost","returnSecureToken":true}
Response: {
  "error": {
    "code": 400,
    "message": "INVALID_IDP_RESPONSE : Unsuccessful check authorization response from Github: {\"message\":\"Not Found\",\"documentation_url\":\"https://docs.github.com/rest/reference/apps#check-a-token\"}",
    "errors": [
      {
        "message": "INVALID_IDP_RESPONSE : Unsuccessful check authorization response from Github: {\"message\":\"Not Found\",\"documentation_url\":\"https://docs.github.com/rest/reference/apps#check-a-token\"}",
        "domain": "global",
        "reason": "invalid"
      }
    ]
  }
}

Reason: Undefined ---> System.Net.Http.HttpRequestException: Код состояния ответа не указывает на успешное выполнение: 400 (Bad Request).
   в System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
   в Firebase.Auth.FirebaseAuthProvider.<ExecuteWithPostContentAsync>d__43.MoveNext()
   --- Конец трассировки внутреннего стека исключений ---
   в Firebase.Auth.FirebaseAuthProvider.<ExecuteWithPostContentAsync>d__43.MoveNext()
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в Firebase.Auth.FirebaseAuthProvider.<SignInWithOAuthAsync>d__19.MoveNext()
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   в FireBaseCore.Core.<RegisterUserByGitHubAsync>d__8.MoveNext() в D:\FireBaseCore\FireBaseCore\Core.cs:строка 104
False
FireBaseCore.Post[]```

tride258 avatar Dec 08 '21 19:12 tride258

identitytoolkit googleapis is no longer supported and all authentication methods except mail + password do not work

tride258 avatar Dec 10 '21 08:12 tride258

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 11 '22 02:07 stale[bot]

Closing the issue due to inactivity. Feel free to re-open

stale[bot] avatar Aug 13 '22 06:08 stale[bot]