Does Firebase support authentication with oAuth for the provider Angellist?
I tried the following (assuming I have the right access_token):
ref.authWithOAuthToken("angellist", access_token, function(error, AuthData) {
if (error) {
console.log("Login Failed!", error);
} else {
console.log("Authenticated successfully with payload:", AuthData);
}
});
but it returned:
Error: Invalid authentication provider specified
How can this be prevented?
Does Firebase support authentication with oAuth for the provider Angellist?
The list of supported identity providers can be found here. Angellist is not in there.
Related
Docusign iOS sdk DSMManager.login(withEmail: ..) method have parameter withEmail, password, integrationkey, host. In integration key I'm passing my app's integration key and for host "https://demo.docusign.net/restapi/"
for email and password i did try my developer account credentials but it gaves
some : Error Domain=user.additional.data.fetch.error Code=-1011 "Unable to fetch additional data for user - The URL provided does not resolve to a resource. Consumer Disclosure does not exist." UserInfo={DSM_com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x600001c94120> { URL: https://demo.docusign.net/restapi/v2/accounts/********/consumer_disclosure } { Status Code: 404, Headers {
Code:
DSMManager.login(withEmail: "email*#gmail.com",
password: "123456",
integratorKey: integratorKey,
host: hostUrl) { (accountInfo, error) in
if (error != nil)
{
NSLog("Error logging in")
// display error prompt
}
else
{
NSLog("User authenticated")
// segue to main navigation controller
}
}
Please note that Legacy Authentication (using cleartext password) is no longer allowed for new applications being built with DocuSign.
Please see more details in the OAuth 2.0 migration page.
Blog post announcing the change..
I'm having a problem integrating Firebase with Microsoft Auth in my iOS App.
The login page has been launched and I can sign in by Office365 account but login auth can not be finished because of the below Error :
"AADSTS50011: The reply url specified in the request does not match the reply urls configured for the application:[app-id]"
I did check the setting in Firebase and below are the settings I add in the app of Azure Active Directory :
Web redirect URL : "*.firebaseapp.com/__/auth/handler"
Supported account types : "Accounts in any organizational directory (Any Azure AD directory Multitenant)"
Here are the swift code I implement :
provider = OAuthProvider(providerID: "microsoft.com")
provider?.customParameters = ["prompt": "consent",
"login_hint": "Login Hint"]
provider?.scopes = ["mail.read", "calendars.read"]
provider?.getCredentialWith(_: nil){ (credential, error) in
if let credential = credential {
Auth.auth().signIn(with: credential) { (authResult, error) in
if let error = error {
print(error.localizedDescription)
}
}
}
}
Does anyone know how to solve the problem or have the same problem?
When registering apps with these providers, be sure to register the
*.firebaseapp.com domain for your project as the redirect domain for your app.
Have you replaced * with your projectName? You can find your Authorized Domain under Authorized Domains in firebase console. The redirect uri should be something like
https://yourFirebaseApp.firebaseapp.com/__/auth/handler
I plan to use Firebase for authentication for my iOS app. But I want to use custom backend for rest of the REST APIs. How can I add authorization for users authenticated with Firebase in my custom backend ? Can we use both custom backend and firebase authentication? How do I maintain the session using both Firebase and custom backend?
You can verify the token on your backend server with the firebase Admin SDK.
So on the app you get a firebase access token and send this to your server.
On IOS you do:
FIRUser *currentUser = [FIRAuth auth].currentUser;
[currentUser getIDTokenForcingRefresh:YES
completion:^(NSString *_Nullable idToken,
NSError *_Nullable error) {
if (error) {
// Handle error
return;
}
// Send token to your backend via HTTPS
// ...
}];
More Info here:
https://firebase.google.com/docs/auth/admin/verify-id-tokens#retrieve_id_tokens_on_clients
On the server you do:
admin.auth().verifyIdToken(idToken)
.then(function(decodedToken) {
var uid = decodedToken.uid;
// ...
}).catch(function(error) {
// Handle error
});
As you can see you even get the "uid" of the user.
More Infos here:
https://firebase.google.com/docs/auth/admin/verify-id-tokens
I'm new to Firebase and iOS and I was wondering if someone knew how to link multiple oAuth Providers. I followed the Firebase docs and tried to implement this function:
func firebaseSignInWithLink(credential: FIRAuthCredential) {
FIRAuth.auth()?.signIn(with: credential, completion: { (user, error) in
if error != nil {
debugPrint("APP: there has been an error signing into firebase, perhaps another account with same email")
debugPrint("APP: \(error)")
// if existing email, try linking
FIRAuth.auth()?.currentUser?.link(with: credential, completion: { (user, error) in
if error != nil {
debugPrint("APP: there has been an error signing into firebase")
debugPrint("APP: \(error)")
}
else {
debugPrint("APP: successfully signed into firebase")
}
})
}
else {
debugPrint("APP: successfully signed into firebase")
}
})
}
The FIRAuth.auth()?.currentUser?.link function never gets called despite the above debugPrint("APP: \(error)") being called. Because this doesn't work, I keep getting the error below:
Optional(Error Domain=FIRAuthErrorDomain Code=17007 \"The email address is already in use by another account.\" UserInfo={NSLocalizedDescription=The email address is already in use by another account., error_name=ERROR_EMAIL_ALREADY_IN_USE, FIRAuthErrorUserInfoEmailKey=example#gmail.com})"
Any help would be greatly appreciated! Thank you :D
I believe you are confused by the instructions. On firebase documentation it reads
To link auth provider credentials to an existing user account:
Sign in the user using any authentication provider or method.
Complete the sign-in flow for the new authentication provider up to, but not including, calling one of the FIRAuth.signInWith methods. For example, get the user's Google ID token, Facebook access token, or email and password.
Get a FIRAuthCredential for the new authentication provider
So you should not call the method FIRAuth.signInWith. I should also point out that you want to create a link to an existing account, so you should have signed in first and then you can link it. This is why you should have a currentUser.
It occurred because of unchecking "Multiple accounts per email address setting firebase setting" from firebase console.
When a user launches the app they are an unauthenticated user and they receive a unauthenticated cognito identity supplied from the DeveloperAuthenticatedIdentityProvider class in the iOS app. I can see that unauthenticated cognito identity in the cognito console. However, when they login and I make a call to my nodejs backend with a logins map of:
{
DevAuthIdentityLogin:<username>
}
and using this backend code:
getCognitoIdentity: function(logins, cognitoId, error) {
var cognitoidentity = new AWS.CognitoIdentity(awsOptions);
var params = {
IdentityPoolId: identityPool,
Logins: logins,
TokenDuration: (60 * 5)
};
cognitoidentity.getOpenIdTokenForDeveloperIdentity(params, function(err, data) {
if (err) {
console.log(err, err.stack);
error(err)
} else {
console.log(data); // successful response
cognitoId(data);
}
});
}
It creates a new identity id with the developer authenticated identity and I can see that in the cognito console, but the old unauthenticated one is not being mapped to this new developer authenticated one.
Do I need to supply the unauthenticated identity id in the logins map when making a call to my backend to associate the two? OR am I not making this call correctly. I need some clarification on how to map/merge these identities please.
I already answered your question on our forums, but you need to include the unauth identitity id as a parameter to the GetOpenIdTokenForDeveloperIdentity call, otherwise Amazon Cognito will have no way of knowing that it should associate your user identifier to that identity.