Hi Nate,
I wil talk about:
- “The application” for the whole “mobile apps + DB + web services + backoffice” system
- “The mobile app” to just talk about the iOS and Android mobile apps
We would like to use Okta for the user management part of our application. In our mind, our database will not contains any user table (or just a very simple one with Id and email maybe).
Globally, Our application will be composed of:
- An iOS and Android mobile app provinding some services to our users (like the eBay app for example)
- An ASP.NET MVC backoffice provinding some management functions to our agents
- A WCF web service providing all user functions to the mobile app
At the end, we want to use Okta through the WCF web service. This web service will provide “Register”, “Login”, “LostPassword” and other “user management” methods to the mobile app.
Assign a user to an app: If think it’s now clear for us what it means to assing a user. Thanks.
For the moment we will integrate Okta in only one application.
- Is there a solution to auto-assign users to the single existing Okta application in the Okta backoffice? Otherwise we will try the
oktaClient.Post()
method.
We have other questions and suggestions about how to implement these “user management” methods into our WCF web services. It’s now maybe easier to continue here than opening Github issues.
Register: we have already implement a “Register” method into our WCF web service. The method creates new Okta user. The only remark here is, the only way to know that an email is already used is to wait for an exception.
- Do you think you could add an
IsUserExists(email, appId)
method into the SDK?
For the moment we do:
private async Task<bool> IsEmailAlreadyUsed(string email)
{
try
{
var user = await this.oktaClient.Users.GetUserAsync(email);
return user != null;
}
catch(Okta.Sdk.OktaApiException)
{
//If the user with the specified email do not exists yet, the SDK throw an Okta.Sdk.OktaApiException
return false;
}
}
Log in: we have open a case in the Okta help center to know how to use the SDK to check if a user exists with its email/password, sent from a simple log in form into the mobile app. The answer was:
I got in touch with a developer about this function and unfortunately this cannot be done , you can’t use the user’s password in any way at this point , I hope this doesn’t block you
- Do you think you could add an
IsUserExists(email, password, appId)
method into the SDK?
- Or maybe a new
GetUserAsync()
overload with email, password parameters
Our login method for the moment:
public async Task<LogInResult> LogIn(string email, string password)
{
if (string.IsNullOrWhiteSpace(email) == false
&& string.IsNullOrWhiteSpace(password) == false)
{
try
{
var user = await this.oktaClient.Users.GetUserAsync(email);
bool result = user != null && user.Credentials.Password // ? ....
if (result == true)
{
return new LogInResult()
{
ResultState = user.Activated.HasValue == true ? ELogInResult.Success : ELogInResult.NotActivatedUser
};
}
}
catch (Exception e)
{
//TODO log e
return new LogInResult()
{
ResultState = ELogInResult.UnexpectedError
};
}
}
return new LogInResult()
{
ResultState = ELogInResult.InvalidCredentials
};
}
I think that’s all for the moment
Thanks again for your help.
If there is anything I’ve not clearly explained do not hesitate to let me know.
Best regards,
Antoine Boulinguez.